PHP curl_errno function
PHP curl_errno function
(PHP 4> = 4.0.3, PHP 5)
curl_errno - Returns the last error number
Explanation
int curl_errno ( resource $ch )
Returns the error number for the last cURL operation.
parameter
ch
By the curl_init () returns a cURL handle.
return value
Returns the error number or 0 (zero) if no error occurred.
Examples
<?php // 创建一个指向一个不存在的位置的cURL句柄 $ch = curl_init('http://404.php.net/'); // 执行 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); // 检查是否有错误发生 if(curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } // 关闭句柄 curl_close($ch); ?>
See also
- curl_error () - Returns the current session once a recent string of error protection
- »Curl error number