anlutro / php-curl

Simple PHP curl wrapper class

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How cURL exception handle with try catch?

rashedshaon opened this issue · comments

In this purpose if server not response or other issues, How cURL exception handle with try catch?

Hey, thanks for bringing this up. Currently it throws a RuntimeException if curl_exec() === false, but I should change it so it's a specific cURLException.

You can also set the CURLOPT_FAILONERROR option to true to get exceptions when the HTTP status code is 400 or higher.

I just tagged 1.1.0, in which the library throws an anlutro/cURL/cURLException if something goes wrong during the curl request. Hope that answers your question!