Easy Tutorial
❮ Func Mysqli Connect Errno Func Filesystem Chmod ❯

PHP curl_error Function

PHP cURL Reference Manual

(PHP 4 >= 4.0.3, PHP 5)

curl_error — Returns a string containing the last error for the current session


Description

string curl_error ( resource $ch )

Returns the error message for the last cURL operation, if any.


Parameters

ch

A cURL handle returned by curl_init().


Return Value

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


Example

<?php
// Create a cURL handle to a non-existent location
$ch = curl_init('http://404.php.net/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

if(curl_exec($ch) === false)
{
    echo 'Curl error: ' . curl_error($ch);
}
else
{
    echo 'Operation completed without any errors';
}

// Close the handle
curl_close($ch);
?>

See Also


PHP cURL Reference Manual

❮ Func Mysqli Connect Errno Func Filesystem Chmod ❯