3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class World { public $name; public $numOnline; public $location; public $type; public $adtInfo; public $onlineRecord; public $creationDate; public $worldQuestTitles; function __construct() { } } $c = curl_init('http://www.tibia.com/community/?subtopic=worlds'); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $html = curl_exec($c); if (curl_error($c)) die(curl_error($c)); curl_close($c); $html = strip_tags($html, "<tr><td><table>"); //Get the html code without remove the specific tags $start = strpos($html, "Additional Information"); //Start for substring $html = substr($html, $start); //Remove the first useless characters $end = strpos($html, "</table>"); //Get the end of the substring $html = substr($html, 22, ($end - 22)); //Last substring - Note: 22 = "Additional Information" Length $arr; preg_match_all("/<td>([^<]*)<\/td>/", $html, $arr); //Regex to the the groups //Array to build all worlds objects $worlds = array(); $index = 0; for($i = 0; $i < count($arr[0]); $i+=5) { $w = new World(); $w->name = $arr[0][$i]; $w->numOnline = $arr[0][$i + 1]; $w->location = $arr[0][$i + 2]; $w->type = $arr[0][$i + 3]; $w->adtInfo = $arr[0][$i + 4]; array_push($worlds, $w); } var_dump($worlds); die(); foreach($worlds as $w){ if(is_object($w)){ //echo $w->name."<br />"; $string = "http://www.tibia.com/community/?subtopic=worlds&world=".$w->name; $ch = curl_init($string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HEADER, true); $html2 = curl_exec($ch); if (curl_error($ch)) die(curl_error($ch)); curl_close($ch); $html2 = strip_tags($html2, "<tr><td><table>"); $start = strpos($html2, "World Information"); $html2 = substr($html2, $start); echo $string."<br />". $html; return; $end = strpos($html2, "</table>"); $html2 = substr($html2, 17, ($end - 17)); echo $start." ".$end; break; } }
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/L3r3L:17 Stack trace: #0 {main} thrown in /in/L3r3L on line 17
Process exited with code 255.
Output for 5.3.17 - 5.6.21
Fatal error: Call to undefined function curl_init() in /in/L3r3L on line 17
Process exited with code 255.