Após executar o código abaixo:
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use Symfony\Component\DomCrawler\Crawler;
$client = new Client();
$resposta = $client->request('GET', 'https://www.alura.com.br/cursos-online-programacao/php');
$html = $resposta->getBody();
$crawler = new Crawler();
$crawler->addHtmlContent($html);
$cursos = $crawler->filter('span.card-curso__nome');
foreach($cursos as $curso){
echo $curso->textContent . PHP_EOL;
}
recebi o seguinte erro:
PHP Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://www.alura.com.br/cursos-online-programacao/php in D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:211
Stack trace:
#0 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(158): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(110): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(47): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(35): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#7 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#8 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Middleware.php(63): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#9 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#10 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Client.php(331): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#11 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Client.php(168): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#12 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Client.php(187): GuzzleHttp\Client->requestAsync('GET', Object(GuzzleHttp\Psr7\Uri), Array)
#13 D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\buscar-cursos.php(9): GuzzleHttp\Client->request('GET', 'https://www.alu...')
#14 {main}
thrown in D:\Alura\2 - Back-end\3 - PHP\5 - Composer\composer\buscador-cursos-alura\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 211