Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 05651bc

Browse files
committed
Merge pull request #144 from RonaldPK/master
Added http status code with getter
2 parents 928f5ad + 1834779 commit 05651bc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

TwitterAPIExchange.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ class TwitterAPIExchange
5959
*/
6060
public $requestMethod;
6161

62+
/**
63+
* The HTTP status code from the previous request
64+
*
65+
* @var int
66+
*/
67+
protected $httpStatusCode;
68+
6269
/**
6370
* Create the API access object. Requires an array of settings::
6471
* oauth access token, oauth access token secret, consumer key, consumer secret
@@ -297,6 +304,8 @@ public function performRequest($return = true, $curlOptions = array())
297304
$feed = curl_init();
298305
curl_setopt_array($feed, $options);
299306
$json = curl_exec($feed);
307+
308+
$this->httpStatusCode = curl_getinfo($feed, CURLINFO_HTTP_CODE);
300309

301310
if (($error = curl_error($feed)) !== '')
302311
{
@@ -381,4 +390,14 @@ public function request($url, $method = 'get', $data = null, $curlOptions = arra
381390

382391
return $this->buildOauth($url, $method)->performRequest(true, $curlOptions);
383392
}
393+
394+
/**
395+
* Get the HTTP status code for the previous request
396+
*
397+
* @return integer
398+
*/
399+
public function getHttpStatusCode()
400+
{
401+
return $this->httpStatusCode;
402+
}
384403
}

0 commit comments

Comments
 (0)