求一个PHP或ASP 远程登陆并采集功能
http://方问要用户密码
用户:djvvweb
密码:djvvwebdjvvweb
访问成功后,可得到:var now_js = "2012-3-17 17:42:02" ;
有没有办法用ASP 代码 程登陆并采集
程序代码:<%
Function BytesToBstr(body,Cset)
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
Function getHTTPPage_dl(url)
Dim http, q_post,getHTTPPage
Set http = CreateObject("Microsoft.XMLHTTP")
http.open "POST",url,False
http.setRequestHeader "Accept", "*/*" '表示我们所用的浏览器能接受的Content-type
http.setRequestHeader "Accept-Language", "zh-cn" '语言
http.setRequestHeader "Referer", "http://" '当前页面是从那个页面链接来的
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" '表示客户端提交给服务器文本内容的编码方式是URL编码,即除了标准字符外,每字节以双字节16进制前加个“%”表示
http.setRequestHeader "Host", "http://sdfsdfsdf/" '所请求的主机
http.setRequestHeader "Content-Length", "55" '表示提交的数据字节大小
http.setRequestHeader "Connection", "Keep-Alive" '数据传递完并不立即关闭连接
http.setRequestHeader "Cache-Control", "no-cache" '返回消息中的Cache用于指定网页缓存
'Http.send ("txtyhm="&Request.Form("txtyhm")&"&employId="&Request.Form("employId")&"&txtkl="&Request.Form("txtkl")&"")
Http.send ()
'getHTTPPage = bytesToBSTR(Http.responseBody,"GB2312")
getHTTPPage = bytesToBSTR(Http.responseBody,"GB2312")
Set http = Nothing
getHTTPPage_dl = getHTTPPage
End Function
%>
<%=getHTTPPage_dl("http://www.")%>
<%=getHTTPPage_dl("http://www.")%>