3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.59 ms | 401 KiB | 8 Q