J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 800 forks source link

httpStatusCode value is null #277

Closed Astro-Otter-Space closed 2 years ago

Astro-Otter-Space commented 5 years ago

Ola,

I have seen that the response from a 'setGetfield' (i haven't tested with other methods) is null. My code exemple :

const URL_TWITTER = 'https://api.twitter.com/1.1/statuses/user_timeline.json';

$listFields = [
    'screen_name' => $screenName,
    'count' => $count,
    'exclude_replies' => true,
    'skip_status' => '1',
    'include_rts' => 1
];

$twitterResponse = $this->twitterWs->setGetfield(http_build_query($listFields))->buildOauth(self::URL_TWITTER, 'GET');

Response :

TwitterAPIExchange {#3141 ▼
  -oauth_access_token: "<my_oauth_access_token>"
  -oauth_access_token_secret: "<my_oauth_access_token_secret>"
  -consumer_key: "<my_consumer_key>"
  -consumer_secret: "<my_consumer_secret>"
  -postfields: null
  -getfield: "?screen_name=MyScreenName&count=1&exclude_replies=1&skip_status=1&include_rts=1"
  #oauth: array:12 [▶]
  +url: "https://api.twitter.com/1.1/statuses/user_timeline.json"
  +requestMethod: "GET"
  #httpStatusCode: null
}

We can see that httpStatusCode value is null