3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ffile = "https://api.privatbank.ua/p24api/pubinfo?exchange&coursid=5"; $ch = curl_init($ffile); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Uncomment this for Windows. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $ffile); $result = curl_exec($ch); //echo '<pre>'; //print_r(curl_getinfo($ch)); //echo '</pre>'; echo 'Errors: ' . curl_errno($ch) . ' - ' . curl_error($ch) . '<br><br>'; if (curl_errno($ch) == 0) { $sload = 0; } else { exit ('!!! Не удалось открыть файл '. $ffile); } curl_close ($ch); if ($sload == 0) { $exchangerates = simplexml_load_file($ffile); // var_dump($xml); // print_r($exchangerates); } else { exit ('Не удалось открыть файл '. $ffile); } $BabosU = 100; foreach ($exchangerates->row as $kurs) { echo $kurs->exchangerate["sale"], ' - ', $kurs->exchangerate["buy"], ' - ', $kurs->exchangerate["base_ccy"], ' - ', $kurs->exchangerate["ccy"], '<br>'; if ($kurs->exchangerate["ccy"] == 'RUR') { $KursBuy = (float) $kurs->exchangerate["buy"]; $KursSale = (float) $kurs->exchangerate["sale"]; } else {} } $BabosR = $BabosU/$KursBuy; echo '<br>','Покупка ',$KursBuy,' Продажа ',$KursSale,'<br>'; echo '<br>','Гривня ',$BabosU,' Рубль ',ceil($BabosR),'<br>'; ?>
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/2mejE:3 Stack trace: #0 {main} thrown in /in/2mejE on line 3
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/2mejE on line 3
Process exited with code 255.