Return a string containing the last error for the current session
Syntax
curl_error ( resource $ch ) : string
Parameters
ch
A cURL handle returned by curl_init().
Return
Returns the error message or '' (the empty string) if no error occurred.
Examples
1
<? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://nonexistent.osbo.com/"); if (curl_exec($ch) === false) { echo curl_error($ch); } curl_close($ch); ?>
Could not resolve host: nonexistent.osbo.com
2
<? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://nonexistent.osbo.com/"); curl_exec($ch); if (curl_errno($ch)) { echo curl_error($ch); } curl_close($ch); ?>
Could not resolve host: nonexistent.osbo.com