On my site I've added a Tweet button. What I want to do is whenever user clicks on that button and the tweet gets posted on user's twitter account, I want to catch the unique id of that tweet and store it into the database. Is it possible to do that using PHP??
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
When calling the REST API (http://api.twitter.com/1/statuses/update.json
-- or whichever format), you get back the ID string. However, it also implies that you must route everything through your server using oAuth.
Alternatively, you could use the JavaScript API, along with one of the official Twitter JS widgets, and create an event listener to catch the tweet
event. From there, you should have appropriate information in the data field of the event (something like evt.data), which you could pass to your server through AJAX.
JS Docs: https://dev.twitter.com/docs/intents/events
REST Docs: https://dev.twitter.com/docs/api