当前位置: 代码迷 >> vbScript >> ASP代码改为vbscript-调用WinHttp.WinHttpRequest.5.1,该如何处理
  详细解决方案

ASP代码改为vbscript-调用WinHttp.WinHttpRequest.5.1,该如何处理

热度:6154   发布时间:2013-02-26 00:00:00.0
ASP代码改为vbscript-调用WinHttp.WinHttpRequest.5.1
我用ASP写了一个模拟登陆网站的程序,想修改成vbscript或javascript,高手帮帮忙
另外请教ASP写的程序模拟登陆时,所有用户登陆时,对方显示IP都为我服务器IP,修改成为script后是否能显示用户自己的IP
<%
u=request("u")
p=request("p")
vsession=request("vsession")
strA="u="&u&"&p="&p&""
Set oReq = server.CreateObject("WinHttp.WinHttpRequest.5.1")
oReq.open "POST","http://www.xxx.com/login",false
oReq.setRequestHeader "Content-Length",Len(strA)
oReq.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
oReq.setRequestHeader "Cookie",vsession
oReq.send strA
response.write GetBody
%>

------解决方案--------------------------------------------------------
1 用户名,密码,才cookie都要事先取得
2 要么就通过字符串替换的方法,将返回的结果中的IP替换掉
VBScript code
u="username"p="password"vsession = "vsession"strA="u=" & u & "&p=" & pSet oReq = CreateObject("WinHttp.WinHttpRequest.5.1")oReq.open "POST","http://www.xxx.com/login",falseoReq.setRequestHeader "Content-Length",Len(strA)oReq.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"oReq.setRequestHeader "Cookie",vsessionoReq.send strAWScript.Echo oReq.ResponseText
  相关解决方案