Ahalya Hegde
Ahalya Hegde

Reputation: 1641

Facebook Hashtag feed PHP cURL

How to get the Facebook hashtag feeds using the Facebook Graph API ? I want to get all the posts of a particular #HashTag.

I tried the below code:

<?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);

?>

But it returns an error :

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

permission granted : read_stream

any solution for this? thank you

Upvotes: 2

Views: 1498

Answers (1)

phwd
phwd

Reputation: 19995

You cannot retrieve the hashtag feed using the API, unless you are using Facebook Trending API (which you will not get access)

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

Upvotes: 3

Related Questions