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
精彩评论