PHP code example of dimgraycat / pickurl

1. Go to this page and download the library: Download dimgraycat/pickurl 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/ */

    

dimgraycat / pickurl example snippets

:sample.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');

$this->setUserAgent("MyCrawler 1.0");

// default is 10sec. It can be shortened by setting.
$this->WaitTime(1);
bash
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install