sign twitter rest request with oauth token

后端 未结 2 1472
误落风尘
误落风尘 2021-01-26 09:56

I have an app using the twitter rest API. Everything is working fine but we\'re bumping into rate limits so we need to authenticate using oAuth. I have the oauth token and secre

相关标签:
2条回答
  • 2021-01-26 10:20

    Twitter documentation links to a few PHP OAuth libraries that you can use to accomplish OAuth authentication.

    0 讨论(0)
  • 2021-01-26 10:35

    Using the TwitterOAuth PHP library it is as simple as this:

    <?php
    require_once('twitteroauth/twitteroauth.php');
    require_once('config.php');
    
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
    
    $content = $connection->get('account/verify_credentials');
    

    There are several more example requests in the demo index.php.

    0 讨论(0)
提交回复
热议问题