ASP simulation method of post submitting data

Source: Internet
Author: User
ASP Simulation method of post submitting data Author:flymorn Source: Floating Easily
Categories:asp Programming posttime:2009-4-7 13:21:40
are article:
Sometimes need to obtain some information on the remote Web site, and the server restricted get way, can only be submitted through post data, this time we can through the ASP to implement the simulation of the post data, drifting easy to process the following part of the code, such as to obtain IP138 IP data address information, code as follows: <%
On Error Resume Next ' fault-tolerant processing

  Function getbody (IPs)   ' Drift-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) ' Drift easy: conversion 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.