有51job的企业用户帐号密码.我想通过xmlhttp提交登陆,以下是代码
Function GetSourceInfo(byval url,pages,Cookies)
Dim xmlhttp,xmlget,bgpos,endpos
Set xmlhttp = CreateObject( "Msxml2.ServerXMLHTTP ")
With xmlhttp
.Open "POST ", url, False
.setRequestHeader "CONTENT-TYPE ", "application/x-www-form-urlencoded "
'.setRequestHeader( "Referer ", "来路的绝对地址 ")
'.setRequestHeader "Cookie ",Cookies 'Cookie
.Send pages 'post的参数
xmlget = bin2str(.responseBody)
End With
set xmlhttp = nothing
GetSourceInfo=xmlget
End Function
Function bin2str(binstr)
Const adTypeBinary = 1
Const adTypeText = 2
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject( "ADODB.Stream ") '建立一个流对象
With BytesStream
.Type = adTypeText
.Open
.WriteText binstr
.Position = 0
.Charset = "GB2312 "
.Position = 2
StringReturn = .ReadText
.close
End With
Set BytesStream = Nothing
bin2str = StringReturn
End Function
'--------------------------------------------------
Cookies = " "
pages = "user=企业名称&login=用户名&password=密码 "
url = "http://my.51job.com/my/mainlogin.php "
response.write(GetSourceInfo(url,pages,Cookies))
------解决方案--------------------返回的页面内容是 "用户名,密码不对 "吗?
------解决方案--------------------看不出毛病
pages = "user=企业名称&login=用户名&password=密码 "要escape一下,这个楼主好像已经做了