3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Setting up curl function curl($url) { $ch = curl_init(); // Starting cURL curl_setopt($ch, CURLOPT_URL, $url); // Defining URL function curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL options $data = curl_exec($ch); // Begin the operation curl_close($ch); // Stopping cURL return $data; // Saving the data } ?> <?php // Culling the data function scrape_between($data, $start, $end){ $data = stristr($data, $start); // Removing all data before starting point $data = substr($data, strlen($start)); // Stripping $start $stop = stripos($data, $end); // Defining the end point $data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrap return $data; // Saving the data } ?> <?php $scraped_page = curl("http://www.hko.gov.hk/aviat/amt_e/atis.htm"); // Defining the page to be grabbed $scraped_data = scrape_between($scraped_page, "A-RUNWAY", "</tr>"); // Defining the data to grab $atis = str_replace("</td><td class=atislines align=\"left\">","",$scraped_data); // Removing unnecessary code $atis2 = str_replace("</td>","",$atis); // Removing unnecessary code $scraped_data_d = scrape_between($scraped_page, "D-RUNWAY", "</tr>"); // Defining the data to grab $atis_d = str_replace("</td><td class=atislines align=\"left\">","",$scraped_data_d); // Removing unnecessary code $atis2_d = str_replace("</td>","",$atis_d); // Removing unnecessary code echo "Active Runway: " . $atis2;// HTML Code being written echo "Second Runway: " . $atis2_d;// HTML Code for D-Runway ?>
based on vH8lg
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/Witg1:4 Stack trace: #0 /in/Witg1(25): curl('http://www.hko....') #1 {main} thrown in /in/Witg1 on line 4
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/Witg1 on line 4
Process exited with code 255.