<?php
$mongo = new Mongo();
$db = $mongo->twitter;
$collection = $db->tweets;
$screen_name = "learnmongo";
$twitter = "http://api.twitter.com/1/statuses/user_timeline.json?";
$twitter .= "screen_name=" . $screen_name;
$curl = curl_init($twitter);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
$usertimeline = curl_exec($curl);
curl_close($curl);
$usertimeline = json_decode($usertimeline);
foreach ($usertimeline as $id => $item) {
$collection->insert($item);
}
?>
execution of this code gives error message as invalid parameters to foreach().plzz reply and hep me to solve this problem