J7mbo / twitter-api-php

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

Used Same Code getting error #190

Closed mehulsbhandari closed 8 years ago

mehulsbhandari commented 8 years ago

{"errors":[{"code":32,"message":"Could not authenticate you."}]}

Please Help

J7mbo commented 8 years ago

Could you post your code?

ghost commented 8 years ago

@J7mbo Hi, thanks for the library, but I can't make it work. I'm getting the same error (code 32) with this code:

$this->config = [
            'oauth_access_token' => Configure::read('Twitter.oauth_access_token'),
            'oauth_access_token_secret' => Configure::read('Twitter.oauth_access_token_secret'),
            'consumer_key' => Configure::read('Twitter.consumer_key'),
            'consumer_secret' => Configure::read('Twitter.consumer_secret')
        ];
$this->apiUrl = 'https://api.twitter.com/1.1/';

$apiEndpoint = 'statuses/user_timeline'; // or 'users/show'
$getfield = '?screen_name=username';
$twitterApi = new TwitterAPIExchange($this->config);
        $return = $twitterApi->buildOauth($this->apiUrl.$apiEndpoint.'.json', "GET")
            ->setGetfield($getfield)
            ->performRequest();

Could you please help me with this issue?

Thanks in advance.

hugovk commented 8 years ago

@kdimrus You could try setGetfield before buildOauth; see https://github.com/J7mbo/twitter-api-php/issues/54#issuecomment-33577700

If that doesn't help, try https://github.com/J7mbo/twitter-api-php/pull/172

ghost commented 8 years ago

@J7mbo Thanks for your reply,

You could try setGetfield before buildOauth

It works for me, thanks