English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
(PHP 4 >= 4.0.3, PHP 5)
curl_errno — Returns the last error number
int curl_errno ( resource $ch )
Returns the error number of the last CURL operation.
ch
The CURL handle returned by curl_init().
Returns the error number or 0 (zero) if no error occurs.
<?php // Create a CURL handle pointing to a non-existent location $ch = curl_init('http://404.php.net/'); // Execute curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); // Check if an error has occurred if(curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } // Close handle curl_close($ch); ?>
curl_error() - Returns a string that protects the most recent error of the current session