xmlhttp发送cookie采集

来源:百度知道 编辑:UC知道 时间:2024/06/25 18:39:09
有一些页面需要登陆才可以访问
我这里有一段利用xmlhttp的小偷代码

<%
Function bytes2BSTR(arrBytes)
strReturn = ""
arrBytes = CStr(arrBytes)
For i = 1 To LenB(arrBytes)
ThisCharCode = AscB(MidB(arrBytes, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(arrBytes, i+1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function

Set a=CreateObject("msxml2.xmlhttp")
a.Open "Get","http://www2.baidu.com/user/user.php",False
a.Send
Response.Write bytes2BSTR(a.responseBody)
%>

我本地已经登陆了http://www2.baidu.com/user/user.p

嗯,可以设置cookies的

编码ing...
终于写好了。我只是把获取到的body输出了。关于要提取什么信息由你自己定制

代码:

baidu.asp

<%
Session.Timeout=30
if session("login")<>1 then

response.write getHTTP("
http://www2.baidu.com/user/user.php","")
session("login")=1
response.end
else

body=getHTTP("http://www2.baidu.com/user/user.php",Request.form&"")

if instr(body,"欢迎访问百度竞价排名客户管理系统")<1 then
Session.Abandon
response.write "<meta http-equiv=""Refresh"" content=""0"" />"
response.end
end if

response.write server.htmlencode(body)

end if

Function getHTTP(url,sendStr)