XMLHTTP Crawl Remote Data post-processing

Source: Internet
Author: User
<%
' Author information:
' Nickname: Little Grey
' qq:103895
' Http://asp2004.net
' Http://blog.111cn.net/iuhxq
hehe = Hello ("Http://mmsg.qq.com/cgi-bin/gddylist?") Type=13&sort=1&page=3 "," Response. Write hehe
Function Hello (strURL, Strstart, Strend, PATRN, REPLSTR)
STR = GetBody (strURL)
str = Mymid (str, strstart, strend)
str = replacetest (PATRN, REPLSTR, str)
Hello = Str
End Function
Function Mymid (Str, Strstart, Strend)
If Strstart = "" Then
i = 0
Else
i = InStr (Str, Strstart)
End If
If strend = "" Then
j = Len (STR)
Else
j = InStr (i, STR, strend)
End If
Mymid = Mid (Str, I, j-i + 1)
End Function
Function replacetest (patrn, Replstr, str1)
Dim regEx, match, Matches
Set regEx = New RegExp
Regex.pattern = patrn
Regex.ignorecase = True
Regex.global = True
Set matches = Regex.execute (str1)
For the match in matches
Replacetest = Replacetest&regex.replace (Match.value, REPLSTR)
Next
End Function
Function GetBody (URL)
Set Objxml = CreateObject ("Microsoft.XMLHTTP")
With Objxml
. Open "Get", Url, False, "", ""
. SEnd
GetBody =. Responsebody
End With
GetBody = Bytestobstr (GetBody, "GB2312")
Set Objxml = Nothing
End Function
Function bytestobstr (strbody, CodeBase)
Set objstream = Server.CreateObject ("ADODB.stream")
With Objstream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.