![]() |
#2
djvv2012-03-18 12:50
![]() <% 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.")%> 运行上面的代码就显示出: HTML code第一个时间获取为:var now_js = "2012-3-18 12:37:18" ; 第二个时间获取为: msxml3.dll 错误 '80070005' 拒绝访问。 /1a.asp,行 30 ------------------------------- 那么在上面的提示:在<%=getHTTPPage_dl("http://www.)%>这行就出错。这因这个页要用户和密码,所以采集不了时间。 所以我想用小偷采集技术采到 http://www. 这个连接验证后页得到的时间。 --------------- 那么代码应该怎么写。 备注: http://www. 用户:djvvweb 密码:djvvwebdjvvweb |
http://
方问要用户密码
用户:djvvweb
密码:djvvwebdjvvweb
访问成功后,可得到:var now_js = "2012-3-17 17:42:02" ;
有没有办法用ASP 代码 程登陆并采集