FriendsOfPHP / Goutte

Goutte, a simple PHP Web Scraper
MIT License
9.26k stars 1.01k forks source link

SSL error causes Goutte to crash uncaught #263

Open jlillyreed opened 8 years ago

jlillyreed commented 8 years ago

When scraping a site, if it has a link to a page with https protocol, but SSL is not enabled on the site, Goutte crashes and Symfony returns a 500 error, rather than gracefully handling the error.

The error that is returned is:

cURL error 35: Server aborted the SSL handshake (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) 500 Internal Server Error - ConnectException

This error occurs and crashes Symfony, regardless if a try { } catch (GuzzleHttp\Exception\ConnectException $ex) {} is put around the request

taiho007008 commented 6 years ago

$client = new Client(); $guzzleClient = new \GuzzleHttp\Client(array( 'verify' => false )); $client->setClient($guzzleClient); $res = $client->request('GET', $url);