ASP access to Tencent IP address interface program code

Source: Internet
Author: User

<script Type=text/javascript Tutorial Src=http://fw.qq.com/ipaddress></script>
<script type=text/javascript>
var hehe1=ipdata[2]
var hehe2=ipdata[3]
alert (HEHE1);
alert (HEHE2);
document.write (Ipdata.join ('));
</script>

How to use ASP to store, from the above data read out.
Reply:
Copy code code as follows:
<%
function Getresstr (Url,code)
Err.Clear
Dim http,returnstr
Set http=server.createobject ("Microsoft.XMLHTTP")
Http.open "Get", Url,false
Http.send ()
If http.readystate =4 Then
If http.status=200 Then
Returnstr=bytestobstr (Http.responsebody,code)
Getresstr=returnstr
End If
End If
End Function
' Function name: bytestobstr
' Function: Convert binary data to characters
' Parameters: body-binary data, cset-text encoding method
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
Dim vurl,tempstr
Vurl= "Http://fw.qq.com/ipaddress"
Tempstr=getresstr (Vurl, "gb2312")
Response.Write "Your IP for (ASP tutorial get real IP):" &split (TempStr, "" "") (1) "" &split (TempStr, "" "") (5) "" &replace ( Split (TempStr, "" "") (7), "City", "" "
%>

ASP access to Tencent IP address interface program code

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.