English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
(PHP 4 >= 4.0.3, PHP 5)
curl_error — Returns a string that protects the last error of the current session
string curl_error ( resource $ch )
Returns a clear text error message from the last CURL operation.
ch
The CURL handle returned by curl_init().
Returns an error message or '' (empty string) if no error occurs.
<?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 'Operation completed without any errors'; } // Close handle curl_close($ch); ?>
curl_errno() - Returns the last error number