简体   繁体   English

如何使用OAuth通过Twitter API进行连接

[英]How to connect via twitter api using OAuth

I am trying to make an web application that should tweet on users account. 我正在尝试制作一个应该在用户帐户上发布的Web应用程序。 I am using this api https://github.com/abraham/twitteroauth and for now I managed to post a tweet on my account using access tokens. 我正在使用此api https://github.com/abraham/twitteroauth ,现在我设法使用访问令牌在自己的帐户上发布了一条推文。

$twitterConnection = new TwitterOAuth(
                    'XXXX', // Consumer Key
                    'XXXX',     // Consumer secret
                    'XXXX',       // Access token
                    'XXXX'      // Access token secret
                    );



$content =  $twitterConnection->get('account/verify_credentials');

$twitterConnection->post('statuses/update', array('status' => "First tweet via API"));
echo  $twitterConnection->http_code;

But when I try to use examples given there to allow application to access someone's account I receive 401 ERROR in redirect.php file. 但是,当我尝试使用此处提供的示例来允许应用程序访问某人的帐户时,我在redirect.php文件中收到401错误。

您是否已在twitter api控制面板中设置了此访问级别?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM