ASP method for simulating post data submission

Source: Internet
Author: User

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")
%>

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.