<?php
$req_url = 'https://api.exchangerate.host/latest?base=USD';
$response_json = file_get_contents($req_url);
// Continuing if we got a result
if(false !== $response_json) {
// Try/catch for json_decode operation
try {
// Decoding
$response = json_decode($response_json);
// Check for success
$moneybirim = $response->rates->TRY;
}
catch(Exception $e) {
// Handle JSON parse error...
}
}
$urunfiyat = 30;
$toplamesx = $urunfiyat * $moneybirim;
echo $toplamesx;
?>