Post to multiple twitter accounts PHP

2020-07-30 03:36发布

i HAVE read many Tutorials on posting to twitter using OAuth like here but i am still unclear on some things.

My requirements is to tweet through multiple accounts for each of which i have a username/password.

Is this possible ? If yes then how do i do it? I am confused how to get the 4secret keys required for each user account that i have.

2条回答
你好瞎i
2楼-- · 2020-07-30 03:57

1. PHP Class: https://github.com/themattharris/tmhOAuth

2. PHP Function

function tweet($status, $consumer_key, $consumer_secret, $user_token, $user_secret){
    include("class.twitter.php");
    $tmhOAuth = new tmhOAuth(array(
        'consumer_key'=> $consumer_key,
        'consumer_secret' => $consumer_secret,
        'user_token'  => $user_token,
        'user_secret' => $user_secret,
    ));
    $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(
      'status' => $status
    ));
}

3. https://dev.twitter.com/apps/new (register an app, get keys foreach account)

4. tweet("yay!", ...);

5. goto 4 but with different keys

查看更多
够拽才男人
3楼-- · 2020-07-30 03:58

Read up on Twitter's authentication scheme, and then have a look at some libraries.

查看更多
登录 后发表回答