curl-errno
curl_errno
Return the last error number
ENTITY
int
curl_errno
CurlHandle
handle
Returns the error number for the last cURL operation.
ENTITY
ENTITY
Returns the error number or 0 (zero) if no error occurred.
[!NOTE] When a
CurlHandleis executed viacurl_multi_exec, this function returns0untilcurl_multi_info_readhas returned the message for that handle. The error code for each individual handle is available as theresultkey returned bycurl_multi_info_read.
ENTITY
| ENTITY | ENTITY |
|---|
ENTITY
curl_errno example
<?php
// Create a curl handle to a non-existing location
$ch = curl_init('http://404.php.net/');
// Execute
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
// Check if any error occurred
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
?>
ENTITY
curl_error, curl_multi_info_read, Curl error codes
这篇文档对你有帮助吗?
谢谢你的反馈!