Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 6 additions and 0 deletions.
  1. +6 −0 Resty.php
View
6 Resty.php
@@ -627,6 +627,10 @@ public function sendRequest($url, $method='GET', $querydata=null, $headers=null,
$this->log("Opening stream…");
$stream = fopen($url, 'r', false, $context);
+ if (!$stream) {
+ $this->log("Stream open failed.");
+ throw new Exception("Stream open failed");
+ }
$this->log("Getting metadata…");
$resp['meta'] = stream_get_meta_data($stream);
@@ -681,12 +685,14 @@ protected function processResponseBody($resp) {
if (in_array($content_type, static::$JSON_TYPES)) {
$this->log("Response body is JSON");
+ $resp['body_raw'] = $resp['body'];
$resp['body'] = json_decode($resp['body']);
return $resp;
} elseif (in_array($content_type, static::$XML_TYPES)) {
$this->log("Response body is XML");
+ $resp['body_raw'] = $resp['body'];
$resp['body'] = new \SimpleXMLElement($resp['body']);
return $resp;

No commit comments for this range

Something went wrong with that request. Please try again.