The code I wrote supposed to do two things: 1- shows the latest post from a twitter user 2- searches for a specific keyword. For the first part, it works perfectly but it fails in case of 'search' option by dumping this error message:
PHP Notice: Undefined offset:
I run the code with this format:
$ php script.php search keyword number
Here is the code:
$result = file_get_contents("http://search.twitter.com/search.json?q=$argv[2]&rpp=$argv[3]&include_entities=true&result_type=mixed");
$decoded = json_decode($result,true);
for($j=0; $j<$argv[3]; $j++)
{
echo ($decoded[$j]['text']);
}
print_r();whatever arrays your using and see if the contain what they're suppose toissetor something. What exact line is the error on?