I am using curl to scrape html from a page to display information. I am trying to figure out how to search for specific pieces of information and display the stats (they arent static numbers).
So far I have:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_URL, "http://{$url}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "{$user}:{$pass}");
$result = curl_exec($ch);
if (!$result) {
echo "<br />cURL error number:" .curl_errno($ch);
echo "<br />cURL error:" . curl_error($ch);
exit;
}
curl_close ($ch);
$requests = <span class=\\"gensumtitle\">Successful requests:</span>;
$reqs = strstr($result, '$requests', false);
print $reqs;
?>
I am looking to display the number which comes after <span class="gensumtitle">Successful requests:</span> in the html.
The html source for this section looks like:
<p class="gensumlines">
<span class="gensumtitle">Successful requests:</span> 32,037
<br /><span class="gensumtitle">Average successful requests per day:</span> 7,996
<br /><span class="gensumtitle">Successful requests for pages:</span> 1,887
Any help would be appreciated!
Thanks