spatie / crawler

An easy to use, powerful crawler implemented in PHP. Can execute Javascript.

Home Page:https://freek.dev/308-building-a-crawler-in-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[requestException] cURL error 60: SSL certificate problem: unable to get local issuer certificate

GabMic opened this issue · comments

Hi, all.
I am trying to figure out what am i doing wrong here, maybe a misconfigured ini setting or something, but am always getting:

cURL error 60: SSL certificate problem: unable to get local issuer certificate.

I am using this in laravel (latest version for now) 8.26
php version is 7.4.2
guzzle version is 7.2.0
spatie/crawler is 6.0

made a console command to run it:

public function handle()
    {
       $controller = new CrawlerController();
       $controller->index('https://taamtov.net');

    }

My class looks like this:

class CrawlerController extends CrawlObserver
{
    private $pages = [];

    public function index($site = null) {

         Spider::create()
            ->setCrawlObserver(new CrawlerController())
            ->setMaximumDepth(3)
            ->startCrawling($site);
    }

    public function willCrawl(UriInterface $url) {
        echo "Now crawling: " . (string) $url . PHP_EOL;
    }

    public function crawled(UriInterface $url, ResponseInterface $response, ?UriInterface $foundOnUrl = null) {
        $u = $url->getPath();
        $code = $response->getStatusCode();
        print_r([$u, $code]);

        $this->pages[] = [
            'path'=>$u,
            'code'=> $code
        ];

        print_r($this->pages);
    }

    public function crawlFailed(UriInterface $url, RequestException $requestException, ?UriInterface $foundOnUrl = null)
    {
        print_r(["url" => $url->getPath(), "requestException" =>  $requestException->getMessage(), 'foundOnUrl' => $foundOnUrl]);
    }
}

openssl in php.ini is activated, if that is something the you need to know.
what am i doing wrong here?
Thanks.