HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

curl_strerror

Description

The curl_strerror of cURL for PHP return string describing the given error code.

Syntax

curl_strerror ( int $errornum ) : string

Parameters

errornum

One of the cURL error codes constants.

Return

Returns error description or NULL for invalid error code.

Examples

1

<?

$ch = curl_init();

    // create a misspelled protocol in the URL
    curl_setopt($ch, CURLOPT_URL, "htps://osbo.com/");

    curl_exec($ch);
    
    if ($errornum = curl_errno($ch)) {
        $return = curl_strerror($errornum);

        echo "cURL error $errornum: $return";
    }

curl_close($ch);
cURL error 1: Unsupported protocol