Code Examples


PHP (CURL)

Accessing Real-Time Exchange Rates

Find below an example of how to access the latest exchange rate data via PHP(CURL):

 

Performing a Currency Conversion

Converting one currency to another in PHP(CURL) is as simple as:

JavaScript (jQuery.ajax)

Exchange Rates can be easily accessed by using jQuery to make an AJAX call. This method is widely used and highly recommended due to its ease of integration.

Accessing Real-Time Exchange Rates

Find below an example of how to access the latest exchange rate data via jQuery.ajax:

 

Performing a Currency Conversion

Converting one currency to another in jQuery.ajax is as simple as:

Java 

Making use of a variety of Apache HTTP Components, there is a fairly simple way to query the API using Java. Based on the following integration methods for the API's live and convert endpoints, we will try to provide a general idea of how currencylayer  JSON data can be accessed using Java.

Accessing Real-Time Exchange Rates

Find below an example of how to access and display the latest exchange rate data using Java:

The Java Output will look like this:

The entire Java demo source code, along with all necessary components, is available for download at our GitHub Repository.

 

 

Was this page helpful?
Questions? Contact Sales .
Need help? Contact Support .
© 2025 APILayer. All rights reserved.