| @@ 500-507 (lines=8) @@ | ||
| 497 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 498 | if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 499 | ||
| 500 | if (($response = curl_exec($c)) === false) |
|
| 501 | { |
|
| 502 | // run failed request again to display response including headers |
|
| 503 | curl_setopt($c, CURLOPT_HEADER, true); |
|
| 504 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
|
| 505 | curl_exec($c); |
|
| 506 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 507 | } |
|
| 508 | ||
| 509 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 510 | ||
| @@ 306-313 (lines=8) @@ | ||
| 303 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 304 | if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 305 | ||
| 306 | if (($response = curl_exec($c)) === false) |
|
| 307 | { |
|
| 308 | // run failed request again to display response including headers |
|
| 309 | curl_setopt($c, CURLOPT_HEADER, true); |
|
| 310 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
|
| 311 | curl_exec($c); |
|
| 312 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 313 | } |
|
| 314 | ||
| 315 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 316 | ||