J7mbo / twitter-api-php

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

Getting User not found error with error code 50 #236

Closed tajinder0071 closed 7 years ago

tajinder0071 commented 7 years ago

I used your code to get the data from twitter, just changed the values in settings array by getting from my developer account. No I am making the GET request same as your example, but getting following response: {"errors":[{"code":50,"message":"User not found."}]}{"ids":[ Some comma separated ids ],"next_cursor":0,"next_cursor_str":"0","previous_cursor":0,"previous_cursor_str":"0"}

Here is my code of index file:

ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "869861207351500800-OVuCg41xL0LNUFI0Ce0dUmmOt8ekMY7",
    'oauth_access_token_secret' => "My oauth_access_token_secret",
    'consumer_key' => "HwCqFiwdmnIJOM8tQUN3jsrxf",
    'consumer_secret' => "My consumer_secret"
);

$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?screen_name=J7mbo';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();
J7mbo commented 7 years ago

Is this absolutely all of the code and there's nothing else in your file being executed??

tajinder0071 commented 7 years ago

@J7mbo My fault I was also hitting a POST api https://api.twitter.com/1.1/blocks/create.json This one was throwing the user not found issue. I needed to get the tweets from a timeline, now I am able to do this with GET request: https://api.twitter.com/1.1/statuses/user_timeline.json

My apologies regarding this. Thank you so much for this very easy to use twitter library.