usr bin php php error_reporting curl curl_init http rate-exchange apps

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/usr/bin/php
<?php
error_reporting(0);
$curl = curl_init("http://rate-exchange.appspot.com/currency?from=$argv[1]&to=$argv[2]");
curl_setopt_array($curl, [
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1
]);
echo json_decode(curl_exec($curl), true)["rate"];
curl_close($curl);