+ -
当前位置:首页 → 问答吧 → 关于ASP模拟登录的问题

关于ASP模拟登录的问题

时间:2011-07-21

来源:互联网

VB code

<%

'函数名:PostHttpPage
'作 用:登录
'参 数:RefererUr-----登录地址
'参 数:PostUrl-----提交地址
'参 数:PostData-----用户参数
'==================================================
Response.write PostHttpPage("http://www.jobcn.com/person/Per_Login.jsp", "http://www.jobcn.com/loginform", "MemberType=1&chkCode=&password=123456&userName=111DDD")

Function PostHttpPage(RefererUrl,PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr 
    'Set xmlHttp = CreateObject("Msxml2.XMLHTTP")
    Set xmlHttp = CreateObject("Msxml2.ServerXMLHTTP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlHttp.setRequestHeader "Referer", RefererUrl
    xmlHttp.Send PostData 
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
        PostHttpPage = "$False$"
        Exit Function
    End If
    PostHttpPage=bytesToBSTR(xmlHttp.responseBody,"GBK")
    'PostHttpPage=xmlHttp.ResponseText
    Set xmlHttp = nothing
End Function 

Function BytesToBstr(body,Cset) 'REM 转换内码
    Dim objstream
    Set objstream = Server.CreateObject("ADODB.stream")
    objstream.Type = 1
    objstream.Mode =3
    objstream.Open
    objstream.Write body
    objstream.Position = 0
    objstream.Type = 2
    objstream.Charset = Cset
    BytesToBstr = objstream.ReadText 
    objstream.Close
    Set objstream = Nothing 
End Function




模拟后不显示,直接跳转了
http://127.0.0.1/public/_head_redirect.jsp?key_str=&url=
是不是jobcn检测外部提交跳转了?

作者: Mapleleaf123   发布时间: 2011-07-21

怎么就没人回一下呢

作者: Mapleleaf123   发布时间: 2011-07-22