ASP Agent collection of the core function code _ Thieves/Collection
Source: Internet
Author: User
Function proxypage (URL)
Set retrieval = CreateObject ("MSXML2. serverxmlhttp.5.0 ")
With retrieval
. SetProxy 2, "255.0.0.0:80" ' Proxy IP: Proxy port
. Open "Get", url, False, "", ""
. setRequestHeader "Referer", "http://www.baidu.com/" ' Forged Referer
. Send
Proxypage = Bytestobstr (. Responsebody)
End With
Set retrieval = Nothing
End Function
With BYTESTOBSTR process, you can define whether the page is Utf-8 or gb2312,utf= "True" for Utf-8 when you collect it
Function Bytestobstr (body)
Dim objstream
Set objstream = Server.CreateObject ("Ad" & "&" Odb.st "&" "&" Ream ")
Objstream. Type = 1
Objstream. Mode =3
Objstream. Open
Objstream. Write body
Objstream. Position = 0
Objstream. Type = 2
If utf= "True" Then
Objstream. Charset = "Utf-8"
Else
Objstream. Charset = "gb2312"
End If
Bytestobstr = objstream. ReadText
Objstream. Close
Set objstream = Nothing
End Function
Code Explanation:
If your system is win 2003 can only use the following code
CreateObject ("MSXML2.") serverxmlhttp.4.0 ")
If you are XP
CreateObject ("MSXML2.") serverxmlhttp.5.0 ")
Forgery Referer is very useful, but for some stations still useful, so the code I added, you can comment out,
Attention:
If you do not write ASP collection, then the code you may not understand, that is not my post on the discussion, I hope to be useful.
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