Post a tweet automatically from a PHP webservice w

2019-09-23 13:21发布

I have a requirement for php script which works as below.The Database is having list of some 20 twitterIDs.Webapp should be able to post a tweet on behalf of any of the twitterID given in the list.This happens back-door that means no user interaction will be involved like redirecting to Twitter Authentication page to allow twitterApp to access some stuff and user will accept to allow access.User doesn't know about this back-end operation.

My questions is :

  1. Is this possible / feasible ?
  2. If possible, how should i approach the development roadmap . My technology is PHP based and involves REST APi integration to a smartphone client.

Looking forward for some deep explanation.

2条回答
趁早两清
2楼-- · 2019-09-23 13:50

At some point the user will have to know about it, they will have to authorize your page the first time (you wouldn't want someone to post on your twitter feed without you knowing about it right?).

When they have authorized your page the first time, you can store the OAuth token you receive at the end of the authentication process and use it later on to post tweets, without asking the user to authenticate herself again, for as long as the token is valid.

查看更多
家丑人穷心不美
3楼-- · 2019-09-23 13:56

You need more than just the twitter IDs to post on their behalf. They will have to authenticate the application first.

This generates two tokens OAuthToken and OAuthTokenSecret, which can be stored in your database back-end and consequently, be used from your PHP back-end to post on behalf of the user, till the user deauthorizes your application, at which point OAuthToken won't function anymore.

Twitter OAuthTokens do NOT expire, but the user can revoke your access.

You can implement the above in PHP using one of the Twitter PHP libraries

查看更多
登录 后发表回答