用VBS实现的发送带Cookie的HTTP请求的代码
智博吧,维基解密梁光烈,公主殿
为了方便测试,先写一个回显cookie的简单的php程序:
<?php
foreach($_cookie as $key => $value)
echo "$key => $value\r\n";
?>
然后分别用serverxmlhttp和xmlhttp测试:
dim http
set http = createobject("msxml2.xmlhttp")
http.open "get", "http://demon.tw/test/cookie.php", false
http.setrequestheader "cookie", "user=demon; passwd=123456"
http.send
wscript.echo http.responsetext
用msxml2.xmlhttp什么都没有返回。
dim http
set http = createobject("msxml2.serverxmlhttp")
http.open "get", "http://demon.tw/test/cookie.php", false
http.setrequestheader "cookie", "user=demon; passwd=123456"
http.send
wscript.echo http.responsetext
用msxml2.serverxmlhttp返回
user => demon
passwd => 123456
以后碰到需要cookie的网页就不用愁了。
原文:
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
-
-
网友评论