2

PHPでREST Api 1.1を使用して、Twitterの友情/作成を実装しようとしていました。しかし、どのように試しても返されます

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [message] => Bad Authentication data
                    [code] => 215
                )
        )
)

私のコードは(Abrahamライブラリを使用し、twitterauthをv1.1に変更しました)

$twitteroauth = new TwitterOAuth( $this->consumer_key, $this->consumer_secret, $oauth_token,     $oauth_token_secret);

$test_create = $twitteroauth->post('friendships/create',array('follow'=>true,'user_id'=>'2529416xx'));

print_r($test_create);exit;
4

3 に答える 3

1

私は専門家ではありませんが (私も同じ問題を抱えています)、oauth のバージョンは 1.0a のままなので変更しないでください。詳細については、こちらhttps://dev.twitter.com/docs/api/1.1/overview#Authentication_required_on_all_endpointsおよびこちらhttps://dev.twitter.com/docs/auth/authorizing-request でのみ確認できます。リクエストの URL。例:

https://api.twitter.com/1.1/statuses/mentions_timeline.json

于 2012-11-30T10:38:58.493 に答える
0

私もあなたと同じ問題を抱えていました。解決策は簡単です。バージョン番号を変更せず (1.0 のまま)、ホストを $host = " https://api.twitter.com/1.1/ ";に変更します。

それは私のものを解決しました!

于 2013-06-12T12:07:26.277 に答える