Wordpress optin plugin with geolocation

Discussion in 'General Programming Chat' started by phirex, Apr 26, 2014.

  1. phirex

    phirex Power Member

    Joined:
    Nov 17, 2009
    Messages:
    515
    Likes Received:
    260
    Hi, been searching and couldn't find any, maybe someone knows...
    I'm looking for a wordpress plugin that will automatically add the country of the user based on their location...
    hope someone knows :)

    thanks
     
  2. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    975
    Likes Received:
    682
    Occupation:
    Web/Bot Developer
    Here is a starting point:

    Code:
    <?php
    $location_data_json= file_get_contents('http://freegeoip.net/json/'.$_SERVER['REMOTE_ADDR']);
    $location_data_array = json_decode($location_data_json);
    // output user's country name
    echo $location_data_array->country_name; 
    ?>
    
     
    • Thanks Thanks x 1
  3. rumseyadam

    rumseyadam Newbie

    Joined:
    Dec 31, 2013
    Messages:
    3
    Likes Received:
    0
    Hi, Phirex

    I'm not getting your point, are looking for chat plugin for WordPress ?
     
  4. sohom

    sohom Senior Member

    Joined:
    May 26, 2013
    Messages:
    986
    Likes Received:
    175
    Location:
    not in Past
    nice json :)
    hope somebody tested it