I am trying to show content based on user location. For example, show if outside of the country, Australia.
I have been using the documentation from this link: http://www.geoplugin.com/webservices/php
This is the code I have been using. It will always show the echo even when I change the location.
<?php
require_once('geoplugin.class.php');
$geoplugin = new geoPlugin();
// If we wanted to change the base currency, we would uncomment the following line
// $geoplugin->currency = 'EUR';
$geoplugin->locate();
echo "Geolocation results for {$geoplugin->ip}: <br />
".
"Country Name: {$geoplugin->countryName} <br />
".
"Country Code: {$geoplugin->countryCode} <br />
";
if ( $geoplugin->countryName != "Australia" ) {
//our visitor is not using the same currency as the base currency
echo "Show International Popup";
}
?>
Cheers