Hi all i am trying to use preg_match to get number of pages from a html that has this format :
in this case i want to grab the number 4 but it never works. Could any one tell me whatHTML Code:<div class="pagingOf">of </div><a class="pagingLink" href="javascript:__doPostBack('ctl00$cpMain$UserViewPictureControl$PagerTop','4')">4</a>
PHP Code:global $curl;
// Retrieve number of pages page.
echo 'Checking friends list... ';
curl_setopt($curl, CURLOPT_URL, './test.html');
curl_setopt($curl, CURLOPT_POST, 0);
$result = curl_exec($curl);
$headers = curl_getinfo($curl);
// Find out how many pages there are.
if (preg_match('~of <a href="(.+?)" class="pagingLink">([0-9]+)</a>~', $result, $matches))
{
$pages = $matches[2];
echo ' Number of pages: $pages ';
unset($matches);
}




Reply With Quote