SoFunction
Updated on 2025-04-14

[Recommended] ASP programming general function collection page 2/2


Collect and obtain the content of the remote page <%
'******************************
'Function: GetURL(url)
'Parameters: url, the URL of the remote page, the URL in the full format must be entered
'Author: Alixi
'Date: 2007/7/12
'Description: Collect and obtain the content of remote pages, which are used by many thieves and collectors.
'Example: <%=GetURL(/)%>
'******************************
Function GetURL(url) 
Set Retrieval = CreateObject("") 
With Retrieval 
.Open "GET", url, False
.Send 
GetURL = bytes2bstr(.responsebody)
'Verify the obtained information. If the information length is less than 100, it means that the interception failed
if len(.responsebody)<100 then
"Failed to obtain remote file <a href="&url&" target=_blank>"&url&"</a>."

end if
End With 
Set Retrieval = Nothing 
End Function
' Binary to string, otherwise garbled code will appear!
function bytes2bstr(vin) 
strreturn = "" 
for i = 1 to lenb(vin) 
thischarcode = ascb(midb(vin,i,1)) 
if thischarcode < &h80 then 
strreturn = strreturn & chr(thischarcode) 
else 
nextcharcode = ascb(midb(vin,i+1,1)) 
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) 
i = i + 1 
end if 
next 
bytes2bstr = strreturn 
end function 
%>