Sometimes it is necessary to obtain some information of a remote website, and the server limits the get method and can only submit post data. At this time, we can simulate the submission of post data through ASP, easy to process the following partsCodeFor example, to obtain IP address information of ip138, the Code is as follows:
<%
on error resume next 'fault tolerance
function getbody (IPS) 'floating-Get remote IP address post information
set HTTPS = server. createobject ("msxml2.xmlhttp")
with HTTPS
. open "Post", "http://www.ip138.com/ips8.asp", false
. setRequestHeader "Content-Type", "application/X-WWW-form-urlencoded"
. send "IP =" & IPS & "& Action = 2"
getbody =. responsebody
end with
getbody = bytestobstr (getbody, "gb2312")
set HTTPS = nothing
end function
function bytestobstr (body, cset) 'convert gb2312
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
response. write getbody ("61.186.177.105")
%>