How to get the visitor IP address details

Source: Internet
Author: User
Tags maxmind

Using the interface program of QQ

<script type=text/Web page special effects src=http://fw.qq.com/ipaddress charset= "gb2312" ></script>
<script type=text/Web page Special effects >
document.write (Ipdata.join ('));
</script>

202.105.128.73, Shenzhen, Guangdong province

<script Type=text/javascript src=http://fw.qq.com/ipaddress></script>
<script type=text/javascript>
document.write
(ipdata[2]);d ocument.write (ipdata[3]);
</script>

Shenzhen city, Guangdong province

Now let's take a look at a Google API to get User IP address details.

<meta http-equiv= "Content-type" content= text/html; "/>
<title>javascript api</title>
<script type=" Text/javascript "src=" http://j.maxmind.co M/app/geoip. Web Effects "></script>
<body>
<script type=" Text/javascript ">
var area = "";
Try
{
if (geoip_city ()!= "" && geoip_city ()!= null)
Area + = geoip_city () + ",";
if (geoip_region_name ()!= "" && geoip_region_name ()!= null)
Area + = Geoip_region_name () + ",";
if (geoip_country_name ()!= "" && geoip_country_name ()!= null)
Area + = Geoip_country_name ();
}
catch (Err)
{
Area= "";
}
</script>
</body>

The API provides a total of 6 interfaces, Geoip_country_code () {Country Code},geoip_country_ name () {Country name},geoip_city () {city name},geoip_region () {Region code}, Geoip_latitude () {longitude},geoip_longitude () {latitude}.

Where the region code for Maxmind internal use of a code, the provincial-level administrative districts by sequencer the number given

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.