Quantcast
Channel: PHP/Web Development » Uncategorized
Viewing all articles
Browse latest Browse all 10

PHP: Scraping paginated list – recursion with anonymous function

$
0
0
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

Viewing all articles
Browse latest Browse all 10

Trending Articles