| @@ 544-551 (lines=8) @@ | ||
| 541 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 542 | if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 543 | ||
| 544 | if (($response = curl_exec($c)) === false) |
|
| 545 | { |
|
| 546 | // run failed request again to display response including headers |
|
| 547 | curl_setopt($c, CURLOPT_HEADER, true); |
|
| 548 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
|
| 549 | curl_exec($c); |
|
| 550 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 551 | } |
|
| 552 | ||
| 553 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 554 | ||
| @@ 406-413 (lines=8) @@ | ||
| 403 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 404 | if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 405 | ||
| 406 | if (($response = curl_exec($c)) === false) |
|
| 407 | { |
|
| 408 | // run failed request again to display response including headers |
|
| 409 | curl_setopt($c, CURLOPT_HEADER, true); |
|
| 410 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
|
| 411 | curl_exec($c); |
|
| 412 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 413 | } |
|
| 414 | ||
| 415 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 416 | ||