Undefined Index


#1

Trying to format my JSON which I am pulling through the API, and getting a little bit of trouble when trying.

Im new to Php and using it to develop. Apologies if it is a stupid question, but have been trying to research and find the correct answer

So at the moment I am just trying to get it to pull the text from tweets through.
Eventually I will need to get coordinates, but trying to make this work first.

Notice: Undefined index: text in /Applications/MAMP/htdocs/TwitSnip/index.php on line 23
Tweet:

This is the code I have:

$data = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);
if($data["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a problem.</h3><p>The following error has occured:</p><p><em>".$data[errors][0]["message"]."</em></p>";exit();}
foreach($data as $item) {
    echo "Tweet: ".$item['text']."<br />";

}

#2

You should var_dump($item); to see what $item actually it.