是否有可能让计算机进入网站www.example.com/something.php?something=something
而没有该用户看到它?
我的目的是让用户启动程序,VBS脚本转到上面列出的网站,并且会发送信息,之后我会自己动手。
答案 0 :(得分:2)
您想要一个HTTP POST请求。在VBScript中你可以这样做:
url = "http://www.example.com/something.php&something=something"
url = Split(url, "&", 2)
Set req = CreateObject("Msxml2.XMLHttp.6.0")
req.open "POST", url(0), False
req.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
req.send url(1)
您可能需要使用以下内容对传递给url(1)
方法的参数字符串(send
)进行编码:
Function Encode(ByVal str)
Set re = New RegExp
re.Pattern = "[^a-zA-Z0-9_.~-]"
enc = ""
For i = 1 To Len(str)
c = Mid(str, i, 1)
If re.Test(c) Then c = "%" & Right("0" & Hex(Asc(c)), 2)
enc = enc & c
Next
Encode = enc
End Function
答案 1 :(得分:0)
我认为你的意思是你想使用POST而不是GET。不确定如何使用VBS但是如果你在something.php中进行表单发布,你可以使用超级全局$ _POST变量来提取表单变量,而无需用户在地址中看到变量。