curl_errno


php128 apg

RETURN the cURL error number.


<?php

int curl_errno
(CurlHandle $handle);


where,

$handle The cURL handle returned by curl_init function
  
?>

 $handle 


The cURL handle returned by curl_init function.


  1 EXERCISE   

<?php

// Create a curl handle to a non-existing location
$ch curl_init('http://404.php.net/');

// Execute
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_exec($ch);

// Check if any error occurred
if(curl_errno($ch))
{
    echo 
'Curl error: ' curl_errno($ch);
}

// Close handle
curl_close($ch);

?>

 RESULT   

Curl error: 6