We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cc08cc commit b85bf16Copy full SHA for b85bf16
lib/CurlRequest.php
@@ -135,10 +135,18 @@ public static function processRequest($ch)
135
// $output contains the output string
136
$output = curl_exec($ch);
137
138
- if(curl_errno($ch)) {
+ if (curl_errno($ch)) {
139
throw new Exception\CurlException(curl_errno($ch) . ' : ' . curl_error($ch));
140
}
141
142
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
143
+ $httpOK = 200;
144
+ $httpCreated = 201;
145
+
146
+ if ($httpCode != $httpOK && $httpCode != $httpCreated) {
147
+ throw new Exception\CurlException("Request failed with HTTP Code $httpCode.");
148
+ }
149
150
// close curl resource to free up system resources
151
curl_close($ch);
152
0 commit comments