| @@ 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 | ||
| @@ 359-366 (lines=8) @@ | ||
| 356 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 357 | if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 358 | ||
| 359 | if (($response = curl_exec($c)) === false) |
|
| 360 | { |
|
| 361 | // run failed request again to display response including headers |
|
| 362 | curl_setopt($c, CURLOPT_HEADER, true); |
|
| 363 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
|
| 364 | curl_exec($c); |
|
| 365 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 366 | } |
|
| 367 | ||
| 368 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 369 | ||