@ 2015-09-08T22:51:29Z <?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;
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 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.4.2 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.21 Fatal error: Call to undefined function curl_init() in /in/L3r3L on line 17
Process exited with code 255 . preferences:dark mode live preview
150.45 ms | 402 KiB | 227 Q