欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

用VBS實(shí)現(xiàn)的發(fā)送帶Cookie的HTTP請(qǐng)求的代碼

 更新時(shí)間:2013年01月14日 00:51:46   作者:  
在昨天的《使用正確版本的XMLHTTP》中賣了個(gè)關(guān)子,ServerXMLHTTP的功能比XMLHTTP強(qiáng)大,你現(xiàn)在大概已經(jīng)猜到了吧。沒錯(cuò),用ServerXMLHTTP可以在HTTP請(qǐng)求頭中加入Cookie,而XMLHTTP不可以
為了方便測(cè)試,先寫一個(gè)回顯Cookie的簡(jiǎn)單的PHP程序:
復(fù)制代碼 代碼如下:

<?php
foreach($_COOKIE as $key => $value)
echo "$key => $value\r\n";
?>

然后分別用ServerXMLHTTP和XMLHTTP測(cè)試:
復(fù)制代碼 代碼如下:

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什么都沒有返回。
復(fù)制代碼 代碼如下:

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的網(wǎng)頁就不用愁了。
原文: http://demon.tw/programming/vbs-http-cookie.html

相關(guān)文章

最新評(píng)論