Answer the question
In order to leave comments, you need to log in
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);
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"
}
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question