Skip to content

Instantly share code, notes, and snippets.

@egguy
Created March 26, 2018 09:31
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 egguy/0ce6660878b832330d1d4b39730d109b to your computer and use it in GitHub Desktop.
Save egguy/0ce6660878b832330d1d4b39730d109b to your computer and use it in GitHub Desktop.
Extract toornament participant list - POC
<?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