Hi all i am trying to use preg_match to get number of pages from a html that has this format :
of <a href="javascript: GotoPage(4);" class="pagingLink">4</a>
in this case i want to grab the number 4 but it never works. Could any one tell me what i am doing wrong ?Hope some one help me .Thanks
Html content :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);
}
HTML Code:of <a href="javascript: GotoPage(4);" class="pagingLink">4</a>




Reply With Quote