日期:2014-05-16  浏览次数:20980 次

小偷程序在服务器无法登录采集
本帖最后由 kapinliu 于 2014-01-04 00:01:37 编辑
本人在本地xp professional系统中做了一个登录采集程序,可以顺利登录采集,但是放到windows server 2008 r2系统的服务器中却只能采集不用登录的,不能登录采集(每次自动跳转到登录页面),请问各位大侠是什么原因,是不是服务器需要什么设置?具体方法如下:
1、post登录方法
Function PostHttpPage(RefererUrl,PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Msxml2.XMLHTTP")  
    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,"GB2312")
    Set xmlHttp = nothing
End Function 
2、抓取信息方法
Function GetHttpPage(HttpUrl)
   If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then
      GetHttpPage="$False$"
      Exit Function
   End If
   Dim Http
   Set Http=server.createobject("MSXML2.XMLHTTP")
   Http.open "GET",HttpUrl,False
   Http.Send()
   If Http.Readystate<>4 then
      Set Http=Nothing 
      GetHttpPage="$False$"
      Exit function
   End if
   GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
   Set Http=Nothing
   If Err.number<>0 then
      Err.Clear
   End If
End Function

------解决方案--------------------
服务器的相关组件支持吗   
------解决方案--------------------
开了多worker processor吧。如果session不能共享的话,就不能登录。试试开单个看看。或者把服务里的asp什么什么state打开看看。
------解决方案--------------------
注意啊,服务器使用cookie来保持会话的,建议你用msxml2.serverxmlhttp这个类
------解决方案---------------