3v4l.org

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

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:
52.47 ms | 401 KiB | 8 Q