php - Twitter API 1.1 hashtag search -


decodei trying search tweets contain hashtag in php. using recommended code keep getting no results it. code using try , results.

$url = 'https://api.twitter.com/1.1/search/tweets.json'; $requestmethod = 'get'; $getfield = '?q=#manutd&result_type=recent';  // perform request $twitter = new twitterapiexchange($settings); echo $twitter->setgetfield($getfield)              ->buildoauth($url, $requestmethod)              ->performrequest(); 

i have tried:

$url = 'https://api.twitter.com/1.1/search/tweets.json'; $requestmethod = 'get'; $getfield = '?q=#manutd&result_type=recent';  // perform request $twitter = new twitterapiexchange($settings); $response = $twitter->setgetfield($getfield)                     ->buildoauth($url, $requestmethod)                     ->performrequest(); var_dump(json_decode($response)); 

and still same results. know why getting no data this

if haven't found answer this, i'd suggest taking @ dev.twitter.com page on search endpoint. can confirm syntax search term using twitter.com/search web ui. outcome of search in url give correct encoding search via api.

as terence noted, need percent-encode hash symbol (%23).

so, after search via web interface, url is:

https://twitter.com/search?q=%23manutd&src=typd 

you'd want query include:

%23manutd 

check out twitter guide on using search endpoint.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -