curl_error

string curl_error(int curld) 

Queries a cURL session for the textual form of the last error encountered.

Returns:

String explaining the last cURL error encountered

Description:

If the last error encountered by the cURL session pointed to by the curld parameter had an associated text string, curl_error returns that text string.

Example:

Explain the last error
 <php /* Try setting each of the following strings to both valid and invalid * values to see how the errors (or lack thereof) are reported. */ $url = 'ftp://ftp.someserver.com'; $upwd = 'myusername:mypassword'; if (!$curld = curl_init()) { echo "Could not initialize cURL session.\n"; exit; } curl_setopt($curld, CURLOPT_URL, $url); curl_setopt($curld, CURLOPT_USERPWD, $upwd); ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.