日期:2014-05-17  浏览次数:20736 次

采集程序抓取网站页面内容...
要用ASP采集程序抓:
http://www.cn.dhl.com/publish/cn/zh/eshipping/track.high.html?pageToInclude=RESULTS&AWB=2695691095&type=fasttrack
这个页面的内容,再显示在自己的页面上,但是好象抓不到,好象是网站布局的问题,不知怎么解决
抓的程序如下:

<%  
On   Error   Resume   Next  
Server.ScriptTimeOut=9999999  
Function   getHTTPPage(Path)  
t=GetBody(Path)  
getHTTPPage=BytesToBstr(t, "GB2312 ")  
End   function  
 
Function   GetBody(url)
on   error   resume   next  
Set   Retrieval   =   CreateObject( "Microsoft.XMLHTTP ")
With   Retrieval
.Open   "Get ",   url,   False,   " ",   " "
.Send
GetBody   =   .ResponseBody  
End   With
Set   Retrieval   =   Nothing
End   Function  

'然后调用XMLHTTP组件创建一个对象并进行初始化设置。  
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   Newstring(wstr,strng)  
Newstring=Instr(lcase(wstr),lcase(strng))  
if   Newstring <=0   then   Newstring=Len(wstr)  
End   Function  
 
Dim   wstr,url      
url= "http://www.cn.dhl.com/publish/cn/zh/eshipping/track.high.html?pageToInclude=RESULTS&AWB=2695691095&type=fasttrack "  
wstr=getHTTPPage(url)        
response.write   wstr
%>

解决测试通过后马上给分


------解决方案--------------------
3连JF啊 ~~~~~~~~~