PHP code example of iggi / crawler

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

    

iggi / crawler example snippets



Iggi\Crawler;

class MyCrawler extends Crawler {

    protected $uri = "https://ignatisd.gr";

    public function __construct($proxy = null, $debug = 0)
    {
        parent::__construct($proxy, $debug);
    }

    public function hello() {
        $response = $this->curlRequest->get($this->getUrl("/hello"))->exec();
        if ($response->code === 200) {
            return json_decode($response->body, true);
        }
        return $this->errorHandler("Request failed");
    }
}


$crawler = new MyCrawler();
$result = $crawler->hello();

print_r($result);
/*
array(
    "success" => true,
    "message" => "Hello world!"
)
*/