currency convertor in php

PHP
<?php
  /////for current update currency using api/////
  $curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.exchangeratesapi.io/latest?base=USD",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "{\n\t\"QuantityOnHand\":1,\n\t\"ReOrderPoint\":1,\n\t\"QuantityAsOfDate\":\"2018-03-01\"\n}",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "postman-token: f8326c98-2bb7-a466-6f5e-cb8bfc5421d0"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
 $response;
  $response= json_decode($response,true);
 $CAD= $response['rates']['CAD'];
 $AUD= $response['rates']['AUD'];
   
   $GBP= $response['rates']['GBP'];
  
 



  // echo"<pre>";
  // print_r($response);
  // echo"</pre>";
 
?>
Source

Also in PHP: