$valuern"; ?> 然后分别用ServerXMLHTTP和XMLHTTP测试: Dim http Set http "/>

广州明生堂生物科技有限公司


用VBS实现的发送带Cookie的HTTP请求的代码

网络编程 用VBS实现的发送带Cookie的HTTP请求的代码 06-22
为了方便测试,先写一个回显Cookie的简单的PHP程序:

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

然后分别用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

校准系统时间的VBS代码
'VBS校准系统时间BYBatManDimobjXML,Url,MessageMessage="恭喜你,本机时间非常准确无需校对!"SetobjXML=CreateObject("MSXML2.XmlHttp")Url="http://open.baidu.com/special/time/"objXML.

VBS中获取系统本次及上次开关机时间的代码(WinXP/win2003/Win7兼容版)
If(Lcase(Right(Wscript.FullName,11))="wscript.exe")ThenCreateObject("WScript.Shell").Run("%Comspec%/C"&Chr(34)&"modeconcols=100&Cscript.exe//NoLogo"&Chr(34)&Wscript.ScriptFullName&Chr(34)&"&&(Echo此

VBS合并一个文件夹里的TXT的实现代码
ConstForReading=1'VBS的这句不能少。dimxint,xinlu,jiuwdimobjfso,objoutputfile,f,fxdimobjTextFile,strtextSetobjFSO=CreateObject("Scripting.FileSystemObject")'创建FSO对象jiuw=inputbox("请输


编辑:广州明生堂生物科技有限公司

标签:时间,代码,系统,测试,本机