This is a stupid easy question for some of you, but i can't seem to get a result printed out.
I keep getting Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\td.php on line 14
Thanks
$url = "http://search.twitter.com/search.json?q=shoes&include_entities=true&rpp=2";
$data = file_get_contents($url);
$result = json_decode($data, true);
foreach ($result->results as $data) {
echo $data->created_at;
}
The json return looks like this.
Array
(
[completed_in] => 0.019
[max_id] => 1.4886632421341E+17
[max_id_str] => 148866324213411841
[next_page] => ?page=2&max_id=148866324213411841&q=shoes&rpp=2&include_entities=1
[page] => 1
[query] => shoes
[refresh_url] => ?since_id=148866324213411841&q=shoes&include_entities=1
[results] => Array
(
[0] => Array
(
[created_at] => Mon, 19 Dec 2011 20:44:32 +0000
...
etc
...