Im not getting the visitors GEOIP information. Instead im getting my server’s ip.
Here is my code.
<?php
if(!isset($_SESSION))
session_start();
require_once ‘lib/unirest-php/src/Unirest.php’;
$key = “MY_KEY”;
key",
“Accept” => “application/json”
)
);
$body = data = json_decode(substr($body, 9,-3));
$_SESSION[‘geoip_country_code’] = $data->country_code;
?>
I need to get the VISITOR’s information and not my server.
Please help me.
Join in the discussion - add comment below:
Hello,
You will need to use the “GeoIP with specific IP” endpoint, and specify the IP address from your visitor as parameter.
Create a variable to store visitor IP :
And use the snippet provided here replacing
{ip_address}
placeholder by the content of the$remote
variable.Hope this helps.
Regards.