Twitter-API-PHP only return NULL


I’m making a code to take users using Twitter-API-PHP, but the return is always NULL.

Below is my code:


//Include the class file

//Set access tokens
$settings = array(
‘oauth_access_token’ => “214180610-XXXXX”,
‘oauth_access_token_secret’ => “XXXXX”,
‘consumer_key’ => “XXXX”,
‘consumer_secret’ => “XXXXX”

//GET Request Example

$url = ‘’;
$getfield = ‘?q=Danilo&page=1&count=1’;
$requestMethod = ‘GET’;

$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)




Are there something wrong? I tried put the codes examples, but all only return NULL.
What should I do?



are you entering your full tokens or have you just xxxxx them out for the example ?


hey @MrDnlGomes did you finally manage to make the code work? I’m getting a NULL as well and can’t figure exactly what’s wrong since it doesn’t say that much, just NULL.


I have the same problem as you! Same code (except that I retrieve the last tweet of an user) and same problem.
It would be great if someone could help us…


Good morning

I’ve solved this by editing TwitterAPIExchange.php file.
Just adding


at the $options array at the performRequest method (line 180 in my case)



Thanks a lot @JuanDiegoMu_oz, this solved it!




A+++++++++++ works thanks yaar