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 $error_code
): ?string

Parameters

error_code

One of the cURL error codes constants.

Return

Returns error description or null for invalid error code.

Examples

1 · error_code

<?

$handle = curl_init();

    curl_setopt($handle, CURLOPT_URL, "https://error.osbo.com/");

    curl_exec($handle);

    if($error_code = curl_errno($handle))
    {
        $return = curl_strerror($error_code);

        echo $return;
    }

curl_close($handle);
Could not resolve hostname