Friday, August 3, 2018

How to parse content from page using CURL?

How to get data from this ?



1,234,567



I need to get statsTopHi data? but dont know how to do it, i'm new to php and dont know anything about curl.



    $handle = curl_init();
curl_setopt($handle, CURLOPT_URL, "my url");
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($handle);
curl_close($handle);

$DOM = new DOMDocument;

$DOM->loadHTML($html);

//get all span
$items = $DOM->getElementsByTagName('span');

//display all span text
for ($i = 0; $i < $items->length; $i++)
echo $items->item($i)->nodeValue . "
";
?>



Using this i parse all span content, but need to get only class="statsTopHi"

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...