(PHP 4 >= 4.0.3, PHP 5)
curl_error — Returns a string protecting the most recent error for the current session
string curl_error (resource $ch)
Returns an explicit textual error message from the most recent cURL operation.
ch
The cURL handle returned by curl_init().
Returns an error message or '' (empty string) if no errors occurred.
<?php// Create a cURL handle pointing to a non-existent location $ch = curl_init('http://404.php.net/');curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);if(curl_exec($ ch) === false){ echo 'Curl error: ' . curl_error($ch);}else{ echo 'The operation was completed without any errors';}// Close the handle curl_close($ch);?>
curl_errno() - returns the last error number
» Curl error codes