I am trying to find next page's link of a particular page(i call that particular page as current page
here).The current page
in program i am using is
http://en.wikipedia.org/wiki/Category:1980_births
The next page link
which i am extracting from the current page
is the below one
But ,, when file_get_contents() function load the next page link
it's getting the the current page
contents ,,,
The code is
<?php
$string = file_get_contents("http://en.wikipedia.org/wiki/Category:1980_births"); //Getting contents of current page ,
preg_match_all("/\(previous page\) \(<a href=\"(.*)\" title/", $string,$matches); // extracting the next_page_link from the current page contents
foreach ($matches[1] as $match) {
break;
}
$next_page_link = $match;
$next_page_link = "http://en.wikipedia.org" . $next_page_link; //the next_link will have only the path , does't contain the domain name ,,, so i am adding the domain name here, this does't make any impact on the problem statement
$string1 = file_get_contents($next_page_link);
echo $next_page_link;
echo $string1;
?>
As per the code string1
should have next_page_link's
content ,, but instead it just getting the current page
's content.