Skip to content

Instantly share code, notes, and snippets.

@oliveiraev
Last active March 1, 2022 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oliveiraev/2d40237ea99ef146044d9a5d86efc28e to your computer and use it in GitHub Desktop.
Save oliveiraev/2d40237ea99ef146044d9a5d86efc28e to your computer and use it in GitHub Desktop.
Get Tibia available Worlds
<?php
$curl = curl_init('https://www.tibia.com/community/?subtopic=killstatistics');
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => 'utf-8',
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array('world' => 'Adra'),
));
$response = curl_exec($curl);
curl_close($curl);
$content = new DOMDocument('1.0', 'utf-8');
$content->loadHTML($response);
$table = $content->getElementsByTagName('table')->item(2);
var_dump($table->ownerDocument->saveHTML($table));
@oliveiraev
Copy link
Author

Updated original version

  1. smallest subset that I've managed to bypass cloudflare challenge
  2. print 'Adra' world statistics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment