delphi cookie发送php,用VBS实现的发送带Cookie的HTTP请求的代码

为了方便测试,先写一个回显Cookie的简单的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的网页就不用愁了。

原文: http://demon.tw/programming/vbs-http-cookie.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值