currency = 'EUR';
The default IP to lookup is $_SERVER['REMOTE_ADDR']
You can lookup a specific IP address, by entering the IP in the call to geoPlugin::locate
eg
$geoplugin->locate('209.85.171.100');
*/
//locate the IP
$geoplugin->locate();
echo "Geolocation results for {$geoplugin->ip}:
\n".
"City: {$geoplugin->city}
\n".
"Region: {$geoplugin->region}
\n".
"Area Code: {$geoplugin->areaCode}
\n".
"DMA Code: {$geoplugin->dmaCode}
\n".
"Country Name: {$geoplugin->countryName}
\n".
"Country Code: {$geoplugin->countryCode}
\n".
"Longitude: {$geoplugin->longitude}
\n".
"Latitude: {$geoplugin->latitude}
\n".
"Currency Code: {$geoplugin->currencyCode}
\n".
"Currency Symbol: {$geoplugin->currencySymbol}
\n".
"Exchange Rate: {$geoplugin->currencyConverter}
\n";
/*
How to use the in-built currency converter
geoPlugin::convert accepts 3 parameters
$amount - amount to convert (required)
$float - the number of decimal places to round to (default: 2)
$symbol - whether to display the geolocated currency symbol in the output (default: true)
*/
if ( $geoplugin->currency != $geoplugin->currencyCode ) {
//our visitor is not using the same currency as the base currency
echo "
At todays rate, US$100 will cost you " . $geoplugin->convert(100) ."
\n"; } /* Finding places nearby nearby($radius, $maxresults) $radius (optional: default 10) $maxresults (optional: default 5) */ $nearby = $geoplugin->nearby(); if ( isset($nearby[0]['geoplugin_place']) ) { echo "\n"; } ?>Some places you may wish to visit near " . $geoplugin->city . ":
\n"; foreach ( $nearby as $key => $array ) { echo ($key + 1) .":
"; echo "\t Place: " . $array['geoplugin_place'] . "
"; echo "\t Region: " . $array['geoplugin_region'] . "
"; echo "\t Latitude: " . $array['geoplugin_latitude'] . "
"; echo "\t Longitude: " . $array['geoplugin_longitude'] . "
"; } echo "