PHP code example of hanccc / crawler
1. Go to this page and download the library: Download hanccc/crawler library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hanccc / crawler example snippets
$this->crawler();
class ExampleDetailCrawler extends DetailCrawler{
//Returns boolean
public function isDetailUrl($url)
{
if(preg_match('/example.com\/id(\d+)/, $url))
return true;
}
// what you want to do about the detail page
public function handle()
{
echo $this->crawler->filter('title')->text();
}
}