PHP-PickUrl depends on PHP 5.5+ and Goutte 1+ and Guzzle 6+.
This library can be found on Packagist. The recommended way to install this is through composer.
Edit your composer.json
and add:
{
"require": {
"dimgraycat/pickurl": "*"
}
}
And install dependencies:
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
Create a Pickurl\Spider Client instance:
<?php
$spider = new PickUrl\Spider();
$spider->addHook('before', function($crawler, $crawl_url) {
print "$crawl_url\n";
})
->addHook('after', function($crawler, $crawl_url, $searched_urls) {
print_r($searched_urls);
})
->crawl('http://foo.sample.com');
set UserAgent:
$this->setUserAgent("MyCrawler 1.0");
set WaitTime:
// default is 10sec. It can be shortened by setting.
$this->WaitTime(1);