获取特定推文的推文 ID [英] Getting Tweet ID of a particular tweet
问题描述
在我的网站上,我添加了一个推文按钮.我想要做的是每当用户单击该按钮并且推文被发布到用户的推特帐户时,我想捕获该推文的唯一 ID 并将其存储到数据库中.是否可以使用 PHP 来做到这一点??
当调用 REST API (http://api.twitter.com/1/statuses/update.json
-- 或无论哪种格式),您都会返回 ID 字符串.但是,这也意味着您必须使用 oAuth 通过您的服务器路由所有内容.
或者,您可以使用 JavaScript API 以及官方 Twitter JS 小部件之一,并创建一个事件侦听器来捕获 tweet
事件.从那里,您应该在事件的数据字段中拥有适当的信息(类似于 evt.data),您可以通过 AJAX 将这些信息传递给您的服务器.
JS 文档:https://dev.twitter.com/docs/intents/events一个>
REST 文档:https://dev.twitter.com/docs/api>
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??
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
这篇关于获取特定推文的推文 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!