<?
$Tweet = file_get_contents("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=EdVizenor&count=1");
//$Tweet = explode(",",$Tweet);
/// If I explode and echo the $Tweet(3); i get .... "text":"mY LATEST TWEET"
var_dump(json_decode($Tweet,true));
?>
What I want to do is parse out the array via key. Something like:
echo $Tweet(text); /// but this does not work.
It would be helpful to know what the error is. The problem is that $Tweet(text)
would be calling a function contained in $Tweet
, since that variable is not a function, but an actual array, you actually just have to
<?php
// your code
$tweets = json_decode($Tweet,true);
echo $tweets[0]['text'];
Next time, be sure to include the error being thrown, it is very helpful for you to read and understand those!