+ Reply to Thread
Results 1 to 4 of 4

Thread: HOW TO: IP Address Geolocation

  1. #1
    FengFeng's Avatar
    FengFeng is offline x10Hosting Member FengFeng is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    China,Canton
    Posts
    59

    Cool HOW TO: IP Address Geolocation

    The code can geolocation the ip address.If it's a Chinese IP,you can get more detail in Chinese.Enjoy it.

    via http://www.dyfeng.co.cc/2009/04/23/i...ress-comments/

    Code:
    <?php
    function ip_query_function($ip){
    $d = file_get_contents("http://www.iplocationtools.com/ip_query.php?ip=$ip&amp;output=xml");
    if (!$d)return false;
    $answer = new SimpleXMLElement($d);
    if ($answer->Status != 'OK')
    return false;
    $country_name = $answer->CountryName;
    $region_name = $answer->RegionName;
    $city = $answer->City;
    if ($country_name=="China")
    {
    $c =file_get_contents("http://www.youdao.com/smartresult-xml/search.s?type=ip&amp;q=$ip");
    $answer = new SimpleXMLElement($c);
    $location = $answer->product[0]->location;
    $ip=$answer->product[0]->ip;
    $return_ip="IP:".$ip." $city,$region_name,$country_name (".$location.")";
    }else{
    $return_ip="IP:".$ip." $city,$region_name,$country_name";
    }
    return $return_ip;
    }
    ?>

  2. #2
    anujan is offline x10Hosting Member anujan is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    2

    Re: HOW TO: IP Address Geolocation

    That's cool.
    Thanks :D

  3. #3
    asoit is offline x10Hosting Member asoit is an unknown quantity at this point
    Join Date
    Mar 2009
    Posts
    35

    Re: HOW TO: IP Address Geolocation

    It would be nice if you could track by the email... Sometimes it turns out very handy

  4. #4
    idontkno is offline x10Hosting Member idontkno is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    49

    Re: HOW TO: IP Address Geolocation

    Quote Originally Posted by asoit View Post
    It would be nice if you could track by the email... Sometimes it turns out very handy
    You can. Just view the email headers and it will show exactly who sent it.

+ Reply to Thread

Similar Threads

  1. Need help with PHP script for IP address of sites
    By phpasks in forum Programming Help
    Replies: 3
    Last Post: 05-09-2008, 08:15 AM
  2. wierd email address
    By enever in forum Free Hosting
    Replies: 7
    Last Post: 03-04-2008, 03:54 AM
  3. HangSMS - Hangman Texting Game
    By brochos in forum Review My Site
    Replies: 5
    Last Post: 12-11-2007, 06:48 PM
  4. Replies: 3
    Last Post: 09-20-2007, 03:16 PM
  5. Changing IP Address
    By Spartan Erik in forum Computers & Technology
    Replies: 2
    Last Post: 08-12-2006, 01:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers