找回密码
 加入
搜索
查看: 6891|回复: 1

[网络通信] 如何利用winhttp访问代理中国,并保持自动登录状态?

[复制链接]
发表于 2014-9-15 09:32:55 | 显示全部楼层 |阅读模式
如何利用winhttp访问代理中国,并保持自动登录状态,获取其代理IP信息?
先登录代理中国(http://bbs.proxycn.cn/),注册用户后进行登录,登录的时候设置cookie有效期为一年。
我们是想获取器免费的代理IP信息,如(http://bbs.proxycn.cn/read.php?tid=445438)。
通过cookie分析工具分析登录后其cookie为:

Web Site     : bbs.proxycn.cn
User         : administrator
Filename     : MRSWR8XU.txt
File Size    : 860 bytes
Hits         : 20
Accessed Date: 2014-09-15 08:55:12
Created Date : 2014-09-15 08:55:12
Modified Date: 2014-09-15 08:55:12

This cookie file contains 8 cookies:

Key     : CNZZDATA79295
Value   : cnzz_eid=1540533274-1410742454-&ntime=1410742454
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:12
Expire  : 2015-03-16 08:55:12
Secure  : No
Created : Client


Key     : 6186b_lastpos
Value   : index
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:41
Secure  : No
Created : Server


Key     : 6186b_ol_offset
Value   : 1358
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:41
Secure  : No
Created : Server


Key     : 6186b_cknum
Value   : AQcABAAGVgFVUjlsBwsFAVgFVgsCBAYAXAQDVQIBBA5XWVUIAgMGDQIEUAc=
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:40
Secure  : No
Created : Server


Key     : 6186b_ck_info
Value   : /       
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:40
Secure  : No
Created : Server


Key     : 6186b_winduser
Value   : BgUIBg8KbQtdUQMEBVpQWlgIAAFQBVQHVARUBAcEA1pUAQJTBVZSPQ==
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:40
Secure  : No
Created : Server


Key     : 6186b_lastvisit
Value   : 0        1410742301        /index.php?
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:41
Secure  : No
Created : Server


Key     : 6186b_ipstate
Value   : 1410742301
Domain  : bbs.proxycn.cn
Modified: 2014-09-15 08:55:11
Expire  : 2015-09-15 08:51:41
Secure  : No
Created : Server

============================================================
============================================================


Web Site     : cnzz.com
User         : administrator
Filename     : 18TUTK6M.txt
File Size    : 92 bytes
Hits         : 3
Accessed Date: 2014-09-15 08:55:12
Created Date : 2014-09-15 08:55:12
Modified Date: 2014-09-15 08:55:12

This cookie file contains one cookie:

Key     : cna
Value   : uCadDNhRNQkCAdo4C112c/wK
Domain  : cnzz.com
Modified: 2014-09-15 08:55:12
Expire  : 2024-09-12 08:54:59
Secure  : No
Created : Server

============================================================
============================================================


Web Site     : cnzz.mmstat.com
User         : administrator
Filename     : P1BE2NJ0.txt
File Size    : 114 bytes
Hits         : 3
Accessed Date: 2014-09-15 08:55:12
Created Date : 2014-09-15 08:55:12
Modified Date: 2014-09-15 08:55:12

This cookie file contains one cookie:

Key     : atpsida
Value   : 05259fab57039bf5d49efa50_1410742499
Domain  : cnzz.mmstat.com
Modified: 2014-09-15 08:55:12
Expire  : 2024-09-12 08:54:59
Secure  : No
Created : Server

============================================================
============================================================


Web Site     : mmstat.com
User         : administrator
Filename     : H6W9MT5E.txt
File Size    : 94 bytes
Hits         : 1
Accessed Date: 2014-09-15 08:54:29
Created Date : 2014-09-15 08:54:29
Modified Date: 2014-09-15 08:54:29

This cookie file contains one cookie:

Key     : cna
Value   : uCadDNhRNQkCAdo4C112c/wK
Domain  : mmstat.com
Modified: 2014-09-15 08:54:29
Expire  : 2024-09-12 08:54:16
Secure  : No
Created : Server

============================================================
============================================================

然后进行编程:
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://bbs.proxycn.cn/read.php?tid=445438")
$oHTTP.SetRequestHeader("Cookie", "6186b_lastvisit=27%091410742283%09%2Fck.php%3Fnowtime%3D1410742494444; CNZZDATA79295=cnzz_eid%3D1540533274-1410742454-%26ntime%3D1410742454; 6186b_lastpos=other; 6186b_ol_offset=582; 6186b_cknum=AQcABAAGVgBdUTlsBg8AAAUCCQMGAQNXVQRXUlVTCQkGDFhTAAEFAQYCUQs%3D")
$oHTTP.SetRequestHeader("Cookie", "cna=uCadDNhRNQkCAdo4C112c/wK; atpsida=05259fab57039bf5d49efa50_1410742499;")
$oHTTP.Send()

;;保存网页返回结果文件
$oH = ObjCreate("Adodb.Stream")
$oH.Type = 1
$oH.Mode = 3
$oH.Open
$oH.write($oHTTP.responseBody)
$oH.SaveToFile("接收.htm", 2);;将 Stream 对象数据保存为文件,第二个参数:1-不允许覆盖,2-覆盖写入
$oH.Close()
任何查看“接收.htm”,总是看不到这些IP地址信息?
1.36.216.242:8088@HTTP$6&312,1560,3323#香港 电讯盈科有限公司
1.161.122.58:8088@HTTP$6&203,1810,2434#台湾省 台北市中华电信
1.168.7.137:8088@HTTP$6&172,468,4665#台湾省 台北市中华电信
1.171.234.5:8088@HTTP$6&140,1264,7129#台湾省 台北市中华电信
请高手共同研究一下。。。。
 楼主| 发表于 2014-9-16 07:54:46 | 显示全部楼层
自己顶一下
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 12:48 , Processed in 0.080082 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表