I'm switching this twitter feed that I used to have to the new(er) v1.1 API that uses OAuth.
I got the feed server side using a Github project someone had done and then outputted it into a variable and echoed it. Only thing is that I'm not familiar with JSON.
require_once("twitteroauth/twitteroauth/twitteroauth.php"); //Path to twitteroauth library
$twitteruser = "goinnative";
// removed token and related variables for this example
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$feed = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
echo $feed;
That's great and all, but now I have two issues:
There seems to be an error at the bottom of my JSON feed. It gives me a line number but no error information and it looks like a PHP error. Any ideas? Full paste of JSON here: http://pastebin.com/0Ba6cwY2
Can I put this JSON output into an array or something and then strip everything but the actual tweet content and links?