geoPlugin Home

Online Currency Converter

Geoplugin provides an online Currency Converter web service. There are two types of currency conversion available - a free IP Geolocation currency converter and a “from any to any” fully flexible Currency Converter API.

Both converters use daily updated and accurate conversion rates. Choose from the list below as to which suits you the best.

Free Currency Converter

The free currency converter takes two forms -

  • One which is available to all IP geolocation requests using any of our IP Geolocation APIs
  • One which is available as an embeddable currency converter for your visitors

Free IP Geolocation Currency Conversion

All calls to any of geoPlugin's IP Geolocation web services provide you with an accurate currency converter function, as well as currency details about your visitor (what is their local currency code and symbol), that is updated daily.

This allows you to easily and accurately provide geolocalized prices in your visitors' local currency on any and all of your pages. That way, if your visitors are from another country, they know how much your products will cost them.

The default base rate returned when calling our web services is $US. If you trade goods in a currency other than $US, you can change this by tagging the variable base_currency=XXX to the web service call, where XXX is a valid ISO 4217 3-letter currency code. eg

http://www.geoplugin.net/javascript.gp?base_currency=EUR

The above code shows how to access the Javascript IP Geolocation webservice.


You can also access this functionality using PHP, JSON, or XML.



PHP, JSON, XML, ASP and CSV webservices all return the exchange rate within the variable geoplugin_currencyConverter.
Javascript, however, returns a function that can directly convert an amount, for reasons explained in this page.

Free Web Page Embedded Currency Converter


You can also embed an online currency converter on your web pages using ajax, taking full use of all available currencies.

Here is a fully independent, real-time currency converter.
An explanation of how to do the same is given here

Convert to



Full Currency Converter API


If you want more flexibility with your currency converter, you can convert from any currency to any currency using our easy to use Currency Converter API.
Note, this any-to-any Currency Converter API is only available to premium Geoplugin subscribers.

The Currency Converter API can present it's results in PHP, JSON, XML, or CSV. How to access each formatting language is explained below.

PHP Currency Converter API


To access the PHP Currency Converter service, add the following url to a remote include call


	http://www.geoplugin.net/currency/php.gp?from=XXX&to=YYY&amount=ZZZ


Substitute:



As an example, the following PHP snippet will convert $100.50 USD to Euros

 
echo var_export(unserialize(file_get_contents('http://www.geoplugin.net/currency/php.gp?from=USD&to=EUR&amount=100.50')));


will output

array (
  'currency_updated' => 'Mon, 11 Nov 2024 08:05:01 +0000',
  'from_amount' => '100.50',
  'from_code' => 'USD',
  'from_name' => 'United States Dollars',
  'from_symbol' => '$',
  'to_amount' => '93.74',
  'to_code' => 'EUR',
  'to_name' => 'Euro',
  'to_symbol' => '€',
)


JSON Currency Converter API


To access the JSON Currency Converter service, add the following url to a remote include call


http://www.geoplugin.net/currency/json.gp?from=XXX&to=YYY&amount=ZZZ


Substitute:



As an example, the following JSON remote call will convert $100.50 USD to Euros


http://www.geoplugin.net/currency/json.gp?from=USD&to=EUR&amount=100.50


will output

{
  "currency_updated":"Mon, 11 Nov 2024 08:05:01 +0000",
  "from_amount":"100.50",
  "from_code":"USD",
  "from_name":"United States Dollars",
  "from_symbol":"$",
  "to_amount":"93.74",
  "to_code":"EUR",
  "to_name":"Euro",
  "to_symbol":"€"
}


AJAX and Error: Invalid label

If you are using jQuery for example to do AJAX calls to the JSON Currency Converter API, you will probably be seeing the Console error Error: Invalid label


This is due to data requests from a server (geoPlugin) in a different domain (your web server). To eliminate this problem, JSONP or “JSON with padding” is required.
To return the JSON results as JSONP, tag jsoncallback=? onto the url when making the jQuery Ajax call to any JSON webservice
eg

 
$.getJSON("http://www.geoplugin.net/currency/json.gp?from=USD&to=EUR&amount=100.50&jsoncallback=?",
function (data) {
	for (var i in data) {
		document.write('data["i"] = ' + i + '<br/>');
	}
);



XML Currency Converter API


To access the XML Currency Converter service, add the following url to a remote include call


http://www.geoplugin.net/currency/xml.gp?from=XXX&to=YYY&amount=ZZZ


Substitute:



As an example, the following JSON remote call will convert $100.50 USD to Euros


http://www.geoplugin.net/currency/xml.gp?from=USD&to=EUR&amount=100.50


will output

<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
	<currency_updated>Mon, 11 Nov 2024 08:05:01 +0000</currency_updated>
	<from_amount>100.50</from_amount>
	<from_code>USD</from_code>
	<from_name>United States Dollars</from_name>
	<from_symbol>&#36;</from_symbol>
	<to_amount>93.74</to_amount>
	<to_code>EUR</to_code>
	<to_name>Euro</to_name>
	<to_symbol>&#8364;</to_symbol>
</geoPlugin>


CSV Currency Converter API


To access the CSV Currency Converter service, add the following url to a remote include call


http://www.geoplugin.net/currency/csv.gp?from=XXX&to=YYY&amount=ZZZ


Substitute:



As an example, the following JSON remote call will convert $100.50 USD to Euros


http://www.geoplugin.net/currency/csv.gp?from=USD&to=EUR&amount=100.50


will output

currency_updated,Mon 11 Nov 2024 07:05:01 +0000
from_amount,100.50
from_code,USD
from_name,United States Dollars
from_symbol,$
to_amount,93.74
to_code,EUR
to_name,Euro
to_symbol,€


ALL the above Currency Converter services are available over SSL


See also

 
 


Acceptable Use Policy    Privacy Policy and User Agreement    Contact geoPlugin


©2006 - 2024 geoPlugin® is a registered trademark of GEOPLUGIN, SAS