Facebook Hashtag提供PHP cURL

时间:2015-04-02 12:48:05

标签: php facebook facebook-graph-api curl hashtag

如何使用Facebook Graph API获取Facebook主题标签?我想获得特定#HashTag的所有帖子。

我尝试了以下代码:

<?php
  $keyword = '#TagName';
  $graph_url = "https://graph.facebook.com/search?type=post&access_token=xxx&q=$keyword";

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $graph_url);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $result = curl_exec($ch);
  curl_close($ch);
  var_dump($result);

?>

但它返回错误:

string(82) "{" error":{"message":"No node specified","type":"GraphMethodException","code":100}}"

授予的权限:read_stream

任何解决方案?谢谢

1 个答案:

答案 0 :(得分:3)

您无法使用API​​检索主题标签Feed,除非您使用的是Facebook趋势API(您无法访问)

https://developers.facebook.com/docs/graph-api/reference/v2.3/hashtag