Getting Tweet ID of a particular tweet

匿名 (未验证) 提交于 2019-12-03 02:33:02

问题:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!