1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP Script to find visitor's location

Discussion in 'PHP' started by theausums, Oct 20, 2008.

Thread Status:
Not open for further replies.
  1. #1
    <?
    $ip = '59.93.196.219';
    $url = "http://www.ipmango.com/api.php?ip=".$ip;
    $xml = simplexml_load_file($url);
    echo "IP address : {$xml->ipaddress} <br />";
    echo "City : {$xml->city} <br />";
    echo "Region : {$xml->region} <br />";
    echo "Country Name : {$xml->countryname} <br />";
    echo "Latitude : {$xml->latitude} <br />";
    echo "Longitude : {$xml->longitude} <br />";
    ?>
     
    theausums, Oct 20, 2008 IP
  2. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I wouldn't rely on another script for that. It just makes stuff slower and more likely to fail
     
    Kyosys, Oct 20, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    Kyosys, to find it out yourselve is quite hard! but if you do so, please cache the results! in a SESSION, DB or textfile because an external PHP request takes more time. Once is ok, but every page is stupid!
     
    EricBruggema, Oct 20, 2008 IP
Thread Status:
Not open for further replies.