diff --git a/TwitterAPIExchange.php b/TwitterAPIExchange.php index 460f879..f33b55c 100755 --- a/TwitterAPIExchange.php +++ b/TwitterAPIExchange.php @@ -254,13 +254,13 @@ public function buildOauth($url, $requestMethod) */ public function performRequest($return = true) { - if (!is_bool($return)) - { - throw new Exception('performRequest parameter must be true or false'); + if (!is_bool($return)) + { + throw new Exception('performRequest parameter must be true or false'); } $header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:'); - + $getfield = $this->getGetfield(); $postfields = $this->getPostfields(); @@ -287,6 +287,14 @@ public function performRequest($return = true) $feed = curl_init(); curl_setopt_array($feed, $options); $json = curl_exec($feed); + + if (($error = curl_error($feed)) !== '') + { + curl_close($feed); + + throw new \Exception($error); + } + curl_close($feed); return $json; diff --git a/test/TwitterAPIExchangeTest.php b/test/TwitterAPIExchangeTest.php index a9ef2ae..404ffbb 100644 --- a/test/TwitterAPIExchangeTest.php +++ b/test/TwitterAPIExchangeTest.php @@ -105,7 +105,7 @@ public function testStatusesHomeTimeline() { $url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'; $method = 'GET'; - $params = '?user_id=3232926711'; + $params = '?user_id=3232926711&max_id=595155660494471168'; $data = $this->exchange->request($url, $method, $params); $expected = "Test Tweet";