得到Twitter屏幕名称

sha*_*han 3 php twitter

我是OAuth的新手

我想知道如何使用"Abraham Wiliam的Twitter OAuth库"来获取用户的凭证信息,例如screen_name.

opt*_*sta 6

下载此库https://github.com/abraham/twitteroauth您只需要twitteroauth.phpOAuth.php文件.只有twitteroauth.php才能包含.

以下是Twitter示例:https://dev.twitter.com/docs/auth/oauth/single-user-with-examples#php

在使用有效的应用令牌声明getConnectionWithAccessToken()函数和$connection变量后,只需尝试代码即可

$user = $connection->get("account/verify_credentials");
print $user->screen_name;
Run Code Online (Sandbox Code Playgroud)

根据这个Twitter REST API参考