2012-10-15 36 views
1

我試圖通過FQL做到這一點,但我想我從錯誤的數據庫或東西檢索信息。Facebook的API - 檢索URL的喜歡

通過該FB像iframe來 '喜歡' 一個網址:

<iframe src="//www.facebook.com/plugins/like.php?href=http://shop.sinkorswimbrand.com/product/sink-or-swim-snapback&amp;send=false&amp;layout=button_count&amp;width=46&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" onclick="javascript:updateLikes();" style="border:none; overflow:hidden; width:46px; height:21px;" allowtransparency="true" frameborder="0" scrolling="no"></iframe> 

使用這個FQL網址檢索有關URL JSON信息:

https://api.facebook.com/method/fql.query?query=select total_count,like_count,comment_count,share_count,click_count from link_stat where url='http://shop.sinkorswimbrand.com/product/sink-or-swim-snapback'&format=json 

返回:--- 注意:我已經確定自己喜歡這個。

[{"total_count":0,"like_count":0,"comment_count":0,"share_count":0,"click_count":0}] 

有沒有人有更多的經驗與Facebook的API有這方面的經驗?提前致謝!

回答

2

問題出在你的og:meta標籤中。您生成的源代碼的第31行這個標籤:

<meta property="og:url" content="http://www.sinkorswimbrand.com" /> 

這告訴Facebook來聚集所有喜歡此頁到www.sinkorswimbrand.com結果。

如果您查看debugger results for your URL的「重定向路徑」部分,可以看到此內容。

如果您希望爲每個單獨的產品頁面添加喜歡,則您需要爲網站的每個頁面提供獨特的og:url標籤。

此外,您正在使用已棄用的URL來進行FQL查詢。你應該使用https://graph.facebook.com/fql?q=...

+0

非常好,我會試試這個 - 非常感謝! – Trey

+0

工作就像一個魅力! – Trey

相關問題