GeoIP Location and Real User Agent API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    GeoIP Location and Real User Agent API

    This script allows you to lookup GeoIP data of any IP address the function of this API outputs the following



    ->Country
    ->Region
    ->City
    ->Country Code
    ->ISP
    ->Real User Agent


    PHP Code:
    <?php

    $geo_ip
    =$_SERVER["REMOTE_ADDR"];
    // Gets information about the current browser's user agent
       
    $gysms_server_link "http://gysms.net/geo/?ip=$geo_ip";
       
    $host $_SERVER['HTTP_HOST']; 
       
    $ch curl_init() ;
       
    curl_setopt$chCURLOPT_URL$gysms_server_link ) ;
       
    curl_setopt$chCURLOPT_HEADER) ;
       
    curl_setopt$chCURLOPT_FRESH_CONNECT) ;
       
    curl_setopt$chCURLOPT_RETURNTRANSFER) ;
       
    curl_setopt($chCURLOPT_REFERER$host);
       
    curl_setopt$chCURLOPT_USERAGENT$_SERVER["HTTP_USER_AGENT"] ) ;
       
    $result curl_exec$ch ) ;
       
    curl_close$ch ) ;
      
    $details json_decode($result);




    $country $details->country;
    $region $details->region;
    $city $details->city;
    $country_code $details->country_code;
    $isp $details->isp;
    $browser $details->browser;




    echo 
    "Country: <b>$country</b><br/>";

    echo 
    "Region: <b>$region</b><br/>";

    echo 
    "City: <b>$city</b><br/>";

    echo 
    "Country Code: <b>$country_code</b><br/>";

    echo 
    "ISP: <b>$isp</b><br/>";

    echo 
    "Real User Agent: <b>$browser</b><br/>";


    ?>


    Demo here: http://gysms.net/tool
Working...
X