问题描述
我想设置一个coldfusion页面,将从我自己的facebook帐户和twitter帐户拉取状态更新,并将它们与他们的时间戳放在一个SQL数据库。每当我运行此页面时,它应该只抓取信息已经在数据库中已经有最近的时间戳。
I'd like to set up a coldfusion page that will pull the status updates from my own facebook account and twitter accounts and put them in a SQL database along with their timestamps. Whenever I run this page it should only grab information after the most recent time stamp it already has within the database.
我希望这不会太糟糕,因为所有我感兴趣的只是状态更新和他们的时间戳。最终我想拉其他的东西,如图像等,但对于第一次测试只是状态更新是好的。任何人都有样本代码和/或指针,可以帮助我在这项努力吗?
I'm hoping this won't be too bad because all I'm interested in is just status updates and their time stamps. Eventually I'd like to pull other things like images and such, but for a first test just status updates is fine. Does anyone have sample code and/or pointers that could assist me in this endeavor?
我想要的,如果任何信息涉及当前版本的apis与oAuth和Facebook打开图)如果他们是必要的。我看到的一些解决方案涉及创建一个twitter应用程序和Facebook应用程序与API交互;是必要的,如果我想做的是访问我自己的帐户信息的一个子集?提前感谢!
I'd like it if any information relates to the current version of the apis (twitter with oAuth and facebook open graph) if they are necessary. Some solutions I've seen involve the creation of a twitter application and facebook application to interact with the APIs; is that necessary if all I want to do is access a subset of my own account information? Thanks in advance!
推荐答案
使用cffeed标记从Twitter和Facebook提取RSS Feed。保留上次进给扫描的日期(应用程序变量或数据库),并循环访问该条目。任何早于上次扫描的条目都将被忽略,其他任何条目都将被提交。确保在try / catch中包装cffeed,因为它会在服务关闭时抛出错误(ahem,twitter)正如其他答案中所提到的,将其设置为计划任务。
Use the cffeed tag to pull RSS feeds from Twitter and Facebook. Retain the date of the last feed scan somewhere (application variable or database) and loop over the feed entries. Any entry older than last scan is ignored, everything else gets committed. Make sure to wrap cffeed in a try/catch, as it will throw errors if the service is down (ahem, twitter) As mentioned in other answers, set it up as a scheduled task.
<cffeed action="read" properties="feedMetadata" query="feedQuery"
source="http://search.twitter.com/search.atom?q=+from:mytwitteraccount" />
这篇关于通过Coldfusion页面将Facebook和twitter状态更新拉入SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!