my code stock.com

Snippet options

Download: Download snippet as php-geo-ip.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<?php
$location=unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));


// echo print_r($location)."\n"; // remove the // for getting all the other api stuff

//echo $_SERVER['REMOTE_ADDR']."\n"; // remove this to test the website, is it showing the external ip-adress?


// load variables via print $location['api_stuff'];
// $currcode=print $location['geoplugin_currencyCode'];




// get the currency code
$currcode=$location['geoplugin_currencyCode'];
$currency=substr($currcode, 0, -1); // remove last character

// print $location['geoplugin_currencyCode']."\n";
// print $currcode."\n";

// if nicht EUR oder nicht GBP, then Ausgabe price GBP, else wenn EUR dann EUR else GBP

// $location['geoplugin_currencyCode'] != "EUR"


// if (( $location['geoplugin_currencyCode'] != "EUR" ) || ( $location['geoplugin_currencyCode'] != "GBP" ))
if (( $location['geoplugin_currencyCode']!="EUR" ) and ( $location['geoplugin_currencyCode']!="GBP" ))
	{
		echo "Ausgabe GBP Ausland<br />";
	}
	elseif ( $location['geoplugin_currencyCode']=="EUR")
	{
		 echo "Ausgabe EUR<br>";
	}
	else
	{
		echo "Ausgabe GBP<br>";
		}



	
// if ( $location['geoplugin_currencyCode'] == "EUR" )


// print $currency."\n";

?>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.