Search
 
SCRIPT & CODE EXAMPLE
 

PHP

curl error handling

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $your_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true); // Required for HTTP error codes to be reported via our call to curl_error($ch)
//...
curl_exec($ch);
if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
}
curl_close($ch);

if (isset($error_msg)) {
    // TODO - Handle cURL error accordingly
}
Comment

PREVIOUS NEXT
Code Example
Php :: disable foreign key laravel 
Php :: why use ob_start() in php 
Php :: php find keyword in string 
Php :: convert am pm time to 24 hour in php 
Php :: laravel send back with message 
Php :: 19 hours from now php 
Php :: php clean html tags 
Php :: for php 
Php :: codeigniter db where between 
Php :: using a php array in jquery 
Php :: var_dump beautify 
Php :: laravel return 1 as true 
Php :: php remove everything after character 
Php :: clear all cache in laravel 
Php :: laravel db does not exists 
Php :: How to Disable the WordPress JSON REST API Without Plugin 
Php :: php server name 
Php :: laravel any error 
Php :: how to get javascript variable value in php 
Php :: yii2 where in 
Php :: php set selected option 
Php :: re migrate laravel 
Php :: increament single column laravel current value + 1 
Php :: Script timeout passed, if you want to finish import 
Php :: counting a string in php 
Php :: how to add property to the request object 
Php :: redirect from index.php 
Php :: php artisan serve a folder 
Php :: laravel update single field 
Php :: switch php version 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =