2011-04-18 38 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>