return $response->getBody();
}
+ public static function quickGetJson($url, $params=array())
+ {
+ $data = json_decode(self::quickGet($url, null, $params));
+ if (is_null($data)) {
+ common_debug('Could not decode JSON data from URL: '.$url);
+ throw new ServerException('Could not decode JSON data from URL');
+ }
+ return $data;
+ }
+
/**
* Convenience function to run a GET request.
*
$this->config['follow_redirects'] = $follow_redirects;
return $this->doRequest($url, self::METHOD_HEAD, $headers);
} catch (Exception $e) {
- // Let the exception go on its merry way.
- throw $e;
- } finally {
// reset to the old value
$this->config['follow_redirects'] = $old_follow;
+
+ // Let the exception go on its merry way.
+ throw $e;
}
//we've either returned or thrown exception here
+
+ // reset to the old value
+ $this->config['follow_redirects'] = $old_follow;
}
/**