开发者

twitter search api not returning results

开发者 https://www.devze.com 2023-01-22 05:59 出处:网络
i\'m doing api calls from php backend like this: $term= \"AT&T Park\"; $q= \'\"\'. urlencode($term) .\'\"\';

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

精彩评论

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