This function below is very helpful in scraping contents from paginated site, using recursion and PHP’s anonymous function. I haven’t tested this function but you can use the same idea. $done_pages = array();$retrieve_pages = function( $page ) use ( &$retrieve_pages, &$done_pages ) { // pass the $retrieve_pages and $done_pages as references $done_pages[] = $page; $file=file_get_contents($page); // … Continue reading PHP: Scraping paginated list – recursion with anonymous function
↧