Skip to content

Instantly share code, notes, and snippets.

@KamranSyed
Created April 22, 2018 06:51
Show Gist options
  • Select an option

  • Save KamranSyed/2d9c0c22ff91a63255593366a5c6e9a0 to your computer and use it in GitHub Desktop.

Select an option

Save KamranSyed/2d9c0c22ff91a63255593366a5c6e9a0 to your computer and use it in GitHub Desktop.
Currency Exchange Rates Web Service Learning by Example
<?php
//This is used in a video tutorial at https://youtu.be/Y777FeIDicU
require_once 'restclient.php';
$url = "http://data.fixer.io/api/";
$api = new RestClient([
'base_url' => $url,
'format' => "json"
]);
$result = $api->get("latest?access_key=abc3d54131d5be95370f61ad306e16ad&symbols=USD,AUD,CAD");
echo "<pre>";
if($result->info->http_code == 200){
print_r($result->decode_response());
}else{
print_r($result);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment