V
V
Valery Zakharov2015-10-12 10:01:36
PHP
Valery Zakharov, 2015-10-12 10:01:36

How to implement facebook hashtag php search?

It is required to implement a hashtag search on Facebook posts. Got to Facebook SDK v5 for PHP.
By trial, error and Google search, I came up with the following code:

$app= new Facebook\FacebookApp($config['app_id'],$config['app_secret']);
$request = new Facebook\FacebookRequest(  $app,   $accessToken,   'GET',    '/search',   array(  'q'=>'запрос'  ));
 $url='https://graph.facebook.com'.$request->getUrl();
  $ch=curl_init();
  CURL_SETOPT($ch,CURLOPT_URL,$url);
  CURL_SETOPT($ch,CURLOPT_RETURNTRANSFER, 1);
  $json=json_decode(curl_exec($ch));
  var_dump($json);

returns:
object(stdClass)#9 (1) {
  ["error"]=>
  object(stdClass)#10 (4) {
    ["message"]=>
    string(30) "An unknown error has occurred."
    ["type"]=>
    string(14) "OAuthException"
    ["code"]=>
    int(1)
    ["fbtrace_id"]=>
    string(11) "HRr/GB73ea4"
  }
}

When getting information about the user and getting a list of photos, everything works fine, but the search does not work, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Ivanov, 2015-10-22
@brainsrage

Something is wrong with the request. It actually returns an error: "(#11) Post search has been deprecated". Those. they removed this method. The task of searching by hashtags with the current set of Facebook API methods cannot be implemented.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question