脚本宝典收集整理的这篇文章主要介绍了php – Facebook杀死公共RSS源;如何使用新的时间轴获取Facebook页面RSS?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<![CDATA[ This Feed URL is no longer valid. VisIT this page to find the new URL,if you have access: &lt;a href="https://www.facebook.COM/PRofile.PHP?id=<FB_ID>">https://www.facebook.com/profile.PHP?id=<FB_ID></a> ]]>
我使用的URL是:
https://www.facebook.com/Feeds/page.PHP?id=<fb_id>&format=RSS20&access_token=<my_page_token>
我没有年龄限制和国家限制:
此外,我尝试了没有我的访问令牌.
https://graph.facebook.com/<page_name>/Feed&https://www.facebook.com/<page_name>/Feed?access_token=<token>
这里发生了什么/如何解决问题?
我明白,我需要自己调用API并构建Feed(我还需要由WP插件和其他东西解析的Feed.
所以,首先得到一个API密钥(也称为app id)并下载PHP Facebook SDK.
然后下载Universal Feed Generator PHP类.它将为您生成所有必需的标题和XMl.
你的PHP脚本将是这样的:
require('lib/facebook.PHP'); // require your facebook PHP sdk include("Feed_generator/FeedWriter.PHP"); // include the Feed generator Feedwriter file $fb = new facebook(array( 'appId' => 'YOUR_APP_ID',// get this info From the facebook develoPErs page 'secret'=> 'YOUR_SECRET_KEY' // by registering an app )); $response = $fb->api('/spreetable/Feed','GET'); // replace "spreetable" with your fb page name or username // create the Feedwriter object (we're using ATOM but there're other options like RSS,etc) $Feed = new FeedWriter(ATOM); $Feed->setTitle('Spree Table'); // set your title $Feed->setLink('http://spreetable.com/facebook/Feed.PHP'); // set the url to the Feed page you're generating $Feed->setChannelElement('updated',date(DATE_ATOM,time())); $Feed->setChannelElement('author',array('name'=>'Spree Table')); // set the author name // iterate through the facebook response to add items to the Feed foreach($response['data'] as $entry){ if(isset($entry["message"])){ $item = $Feed->createNewItem(); $item->setTitle($entry["from"]["name"]); $item->setDate($entry["updated_time"]); $item->setDescription($entry["message"]); if(isset($entry["link"])) $item->setLink(htMLentities($entry["link"])); $Feed->addItem($item); } } // that's it... don't echo anything else,just call this method $Feed->genarateFeed();
未来的注意事项(2013-07-09):不要再听我的回答了.老了Facebook有一个新的API,其查询语言具有新功能,因此不要打扰提取.尝试使用他们的API更有趣,聪明的方式:)
以上是脚本宝典为你收集整理的php – Facebook杀死公共RSS源;如何使用新的时间轴获取Facebook页面RSS?全部内容,希望文章能够帮你解决php – Facebook杀死公共RSS源;如何使用新的时间轴获取Facebook页面RSS?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。