The Code is as follows:
Copy codeThe Code is as follows: <%
'Use ASP to obtain remote target webpage specified content, Code provided by Guangzhou Website Construction Co., http://www.jb51.net.
On Error Resume Next
Server. ScriptTimeOut = 9999999
Function getHTTPPage (Path)
T = GetBody (Path)
GetHTTPPage = BytesToBstr (t, "GB2312 ")
End function
Function Newstring (wstr, strng)
Newstring = Instr (lcase (wstr), lcase (strng ))
If Newstring <= 0 then Newstring = Len (wstr)
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
Function GetBody (url)
On error resume next
Set Retrieval = CreateObject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "Get", url, False ,"",""
. Send
GetBody =. ResponseBody
End
Set Retrieval = Nothing
End Function
'Asp starts to get the specified content of a remote webpage
Dim wstr, str, url, start, over, dtime
A = "Start content" 'asp get target webpage content start mark
B = "End Content" 'asp get the end mark of the webpage content
Url = "http:// SC .jb51.net /"
Wstr = getHTTPPage (url)
Start = Newstring (wstr,)
Over = Newstring (wstr, B)
Body = mid (wstr, start, over-start)
Response. write "" & body & "" 'output the obtained webpage content
'Asp: retrieving the specified content of a remote webpage ends.
%>
The above code can get the content of the specified webpage. If it is all, it will be simpler.
Core code:Copy codeThe Code is as follows: 'asp starts to get the specified content of a remote webpage.
Dim wstr, str, url, start, over, dtime
Url = "http:// SC .jb51.net /"
Wstr = getHTTPPage (url)
Body = wstr