ASP采集小偷,指定数据无法抓取

http://chaxun.ttk.cn:8084/BarScanRecord/trackInfo_jsp.jsp?expBill=560230596486&opeCate=2
页面里我只想偷取,当前状态:已签收,但一直无法实现,请指教以下为小偷代码

 <%
  '功能:asp采集代码
   'url="http://www.kuaidi100.com/query?type=tiantian&postid=560230596486"
url="http://chaxun.ttk.cn:8084/BarScanRecord/trackInfo_jsp.jsp?expBill=560230596486&opeCate=3"  
  str=getHTTPPage(url)
  title=strcut(str,"签收网点","66",2)
  content=strcut(str,"跟踪","图片",2)  
  response.write "标题<br><b>"&title&"</b><br><br><br>内容:<br>"&content  
%>
<%
Function getHTTPPage(url) 
    On Error Resume Next
    dim http 
    set http=Server.createobject("Msxml2.XMLHTTP") 
    Http.open "GET",url,false 
    Http.send() 
    if Http.readystate<>4 then
        exit function 
    end if 
    getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")
    set http=nothing
    If Err.number<>0 then 
        Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>" 
        Err.Clear
    End If  
End Function

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
'Download by http://www.codefans.net
'截取字符串,1.包括起始和终止字符,2.不包括
Function strCut(strContent,StartStr,EndStr,CutType)
    Dim strHtml,S1,S2
    strHtml = strContent
    On Error Resume Next
    Select Case CutType
    Case 1
        S1 = InStr(strHtml,StartStr)
        S2 = InStr(S1,strHtml,EndStr)+Len(EndStr)
    Case 2
        S1 = InStr(strHtml,StartStr)+Len(StartStr)
        S2 = InStr(S1,strHtml,EndStr)
    End Select
    If Err Then
        strCute = "<p align='center'>没有找到需要的内容。</p>"
        Err.Clear
        Exit Function
    Else
        strCut = Mid(strHtml,S1,S2-S1)
    End If
End Function
%>

请求错页面了,你的那个页面是用ajax动态加载数据的,要请求http://chaxun.ttk.cn:8084/BarScanRecord/search.jsp这个页面,发送code='560230596486'&opecate=7&ope=domore数据,不过返回的是16进制的编码内容,需要用jscript做中间体来解码和读取json内容。

<script runat="server" language="jscript">
    var o = false;
    function getKV(str, key) {
        if (!o) {
            try {
                o = eval('(' + str + ')');
                if (o.result && o.result.length > 0) {
                    o = eval('(' + o.result[0] + ')');
                    o = o[0];
                }
            }
            catch (ex) { Response.Write(ex.Message + "|EVAL ERROR");o = {}}
        }
        return o[key] || '';
    }
</script>
<%
url="http://chaxun.ttk.cn:8084/BarScanRecord/search.jsp?code=%27560230596486%27&opecate=7&ope=domore"'这个地址返回下面的结果
 '{"result":["[{\"\u8FD0\u5355\u7F16\u53F7\":\"560230596486\",\"\u5F55\u5165\u65F6\u95F4\":\"2014-12-01\",\"\u5BC4\u4EF6\u7F51\u70B9\":\"\u65E0\u9521\",\"\u5BC4\u4EF6\u627F\u5305\u533A\":\"\u65E0\u9521\u534E\u4E1C\u5546\u76DF\u57CE\",\"\u6D3E\u4EF6\u627F\u5305\u533A\":\"\u8302\u540D\u9AD8\u5DDE\u5206\u90E8\",\"\u7B7E\u6536\u7F51\u70B9\":\"\u8302\u540D\u5206\u516C\u53F8\",\"\u53D6\u4EF6\u5458\":\"\",\"\u53D6\u4EF6\u65F6\u95F4\":\"2014-12-01 21:29:50\",\"\u6700\u540E\u64CD\u4F5C\u65F6\u95F4\":\"2014-12-04 13:17:31\",\"\u6700\u540E\u64CD\u4F5C\u7F51\u70B9\":\"\u8302\u540D\u9AD8\u5DDE\u5206\u90E8\",\"\u5168\u7A0B\u5141\u8BB8\u65F6\u95F4\":\"\",\"\u5BC4\u4EF6\u4EBA\":\"\u4E8E\u6D77\",\"\u5BC4\u4EF6\u5730\u5740\":\"\u5858\u5357\u8DEF120\u53F7\",\"\u5BC4\u4EF6\u7701\":\"\u6C5F\u82CF\u7701\",\"\u5BC4\u4EF6\u57CE\u5E02\":\"\u65E0\u9521\u5E02\",\"\u5BC4\u4EF6\u533A\u53BF\":\"\u5357\u957F\u533A\",\"\u63A5\u6536\u4EBA\":\"******\",\"\u63A5\u6536\u5730\u5740\":\"\u5357\u5173\u8857\u5174\u8D243\u5DF726\u53F7\",\"\u63A5\u6536\u7701\":\"\u5E7F\u4E1C\u7701\",\"\u63A5\u6536\u57CE\u5E02\":\"\u8302\u540D\u5E02\",\"\u63A5\u6536\u533A\u53BF\":\"\u9AD8\u5DDE\u5E02\",\"\u8FD0\u5355\u72B6\u6001\":\"\u5DF2\u7B7E\u6536\",\"\u5BC4\u4EF6\u4EBA\u7535\u8BDD\":\"15995838872\",\"\u6536\u4EF6\u4EBA\u7535\u8BDD\":\"******\",\"\u53D6\u4EF6\u8D85\u533A\":\"0\",\"\u6D3E\u9001\u8D85\u533A\":\"0\",\"\u53D6\u4EF6\u8D85\u533A\u5730\u5740\":\"\",\"\u6D3E\u9001\u8D85\u533A\u5730\u5740\":\"\",\"\u8BA2\u5355\u53F7\":\"LP00029601851949\",\"VIP\u5BA2\u6237\u7F16\u7801\":\"\",\"VIP\u5BA2\u6237\u7F51\u70B9\":\"\"}]"]} 
str=getHTTPPage(url)
  if str<>"" then
    response.Write getKV(str,"运单状态")&"<br/>"
    response.Write getKV(str,"寄件网点")&"<br/>"
    response.Write getKV(str,"寄件人")
end if

  %>
<%
Function getHTTPPage(url) 
    'On Error Resume Next
    dim http 
    set http=Server.createobject("Msxml2.XMLHTTP") 
    Http.open "get",url,false 
    Http.send() 
    getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")
    set http=nothing
    If Err.number<>0 then 
        Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>" 
        Err.Clear
    End If  
End Function
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
%>

那个是动态的页面,下面代码可以帮您生成静态页面,这样的话才可以

<%
if SaveFile("/htm/list.htm","http://www.xxx.com/asp/list.asp") then
Response.write "已生成"
else
Response.write "没有生成"
end if

function SaveFile(LocalFileName,RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server.CreateObject("Microso" & "ft.XM" & "LHTTP")
With Retrieval
.Open "Get", RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Ado" & "db.Str" & "eam")
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads=nothing
if err <> 0 then
SaveFile = false
err.clear
else
SaveFile = true
end if
End function
%>