Created
March 26, 2018 09:31
-
-
Save egguy/0ce6660878b832330d1d4b39730d109b to your computer and use it in GitHub Desktop.
Extract toornament participant list - POC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, 'https://www.toornament.com/tournaments/1298026881086267392/participants/'); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
$return = curl_exec($curl); | |
curl_close($curl); | |
$dom = new DOMDocument; | |
libxml_use_internal_errors(true); | |
$dom->loadHTML($return); | |
$xpath = new DOMXPath($dom); | |
// $tournament_users = new SimpleXMLElement($tidy); | |
foreach($xpath->query("//div[contains(@class, 'participant')]/div[@class='identity']/div") as $participant){ | |
// print_r($participant); | |
print($participant->textContent); | |
print("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment