English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
(PHP 5 >= 5.5.0)
curl_strerror — Returns the description of the error code.
string curl_strerror ( int $errornum )
Returns the text description information of the error code.
errornum
One » CURL Error CodesConstants.
Returns error code description information, returns NULL for illegal error codes.
<?php // Create a CURL handle with a misspelled URL $ch = curl_init("htp://example.com/"); // Send request curl_exec($ch); // Check error code and display error information if($errno = curl_errno($ch)) { $error_message = curl_strerror($errno); echo "CURL error ({$errno}):\n {$error_message}"; } // Close handle curl_close($ch); ?>
The following example will output:
CURL error (1): Unsupported protocol