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

curl_error

Description

The curl_error of cURL for PHP return a string containing the last error for the current session.

Syntax

curl_error(
    CurlHandle $handle
): string

Parameters

handle

A cURL handle returned by curl_init().

Return

Returns the error message or '' (the empty string) if no error occurred.

Examples

1 · handle · curl_errno

<?

$handle = curl_init();

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

    curl_exec($handle);

    if(curl_errno($handle))
    {
        $return = curl_error($handle);

        echo $return;
    }

curl_close($handle);
Could not resolve host: error.osbo.com

2 · handle · curl_exec

<?

$handle = curl_init();

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

    if(curl_exec($handle) === false)
    {
        $return = curl_error($handle);

        echo $return;
    }

curl_close($handle);
Could not resolve host: error.osbo.com