2011-04-18 26 views
0

我一直在尋找如何返回從Facebook自己的網站上面分享的鏈接列表頂部的共享鏈接,我發現FQL http://developers.facebook.com/docs/reference/fql/link_stat/ 但是當我作了妥善處理它作爲普通的SQL試圖如何返回從Facebook

SELECT share_count, like_count, comment_count, total_count,url 
    FROM link_stat 
    WHERE url like '%mysite.com/stories/%' 

我得到了以下錯誤...任何想法我們的工作各地去使用URL列表和計數

601 Parser error: unexpected 'like' at position 88 

感謝

+0

什麼錯誤?你在使用哪個數據庫? – 2011-04-18 21:04:10

+0

我得到601解析器錯誤:意外的'喜歡'在位置88.什麼是你的意思是數據庫?我使用這個網頁來測試我的查詢https://api.facebook.com/method/fql.query?query=SELECT%20share_count,%20like_count,%20comment_count,%20total_count,url%20FROM%20link_stat%20WHERE%20url% 20like%20'%mysite.com/stories /%' – 2011-04-18 21:07:33

回答

1

他們這樣做不接受LIKE參數

+0

是否有其他解決方法? – 2011-04-18 22:01:25

+0

http://stackoverflow.com/questions/1648285/does-facebook-fql-contain-the-sql-like-operator可能這個,但我不認爲他們這樣做是因爲性能的原因。 – Vish 2011-04-18 22:07:31

1

有一個在FQL

沒有像查詢,你可以嘗試

http://www.masteringapi.com/tutorials/facebook-fql-how-to-search-partial-strings-similar-to-mysql-like-operator/27/

您沉思給出確切的鏈接,不能使用像FQL。您可以在https://developers.facebook.com/docs/reference/rest/fql.query/上測試

SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url='http://en.saturngod.net' OR url ='http://en.saturngod.net/mysql-cache-with-php-apc' 
0

您需要完整填寫URL。我只是跑這個例子:

https://api.facebook.com/method/fql.query?query=SELECT%20share_count,%20like_count,%20comment_count,%20total_count%20FROM%20link_stat%20WHERE%20url=%22http://eggie5.com%22&access_token= ...

,並得到這樣的:

<?xml version="1.0" encoding="UTF-8"?> 
<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true"> 
    <link_stat> 
    <share_count>0</share_count> 
    <like_count>0</like_count> 
    <comment_count>0</comment_count> 
    <total_count>0</total_count> 
    </link_stat> 
</fql_query_response>