1$ch = curl_init();
2curl_setopt($ch, CURLOPT_URL, $your_url);
3curl_setopt($ch, CURLOPT_FAILONERROR, true); // Required for HTTP error codes to be reported via our call to curl_error($ch)
4//...
5curl_exec($ch);
6if (curl_errno($ch)) {
7 $error_msg = curl_error($ch);
8}
9curl_close($ch);
10
11if (isset($error_msg)) {
12 // TODO - Handle cURL error accordingly
13}