开发者

twitter search api not returning results

i'm doing api calls from php backend like this:

$term     = "AT&T Park";        
$q        = '"'. urlencode($term) .'"';
$url      = "http://search.twitter.com/search.json?q={$q}&rpp=100";
$api_call = file_get_contents($url);

it's not returning anything, but same api call working just fine on my terminal.

here is a little screenc开发者_开发百科ast showing what's going on:

http://screencast.com/t/RnZsrwfGcc2q

any ideas?


you need to urlencode the quotes too.

change your code to the following

$term     = '"AT&T Park"';
$q        = urlencode($term);
$url      = "http://search.twitter.com/search.json?q={$q}&rpp=100";
$api_call = file_get_contents($url);

and it should work


You can use cURL in your PHP file. This may work.

http://us3.php.net/manual/en/function.curl-init.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜