eqpaisley Posted September 15, 2013 Share Posted September 15, 2013 Hi all. I am trying to get a list of the 3-5 most recent tweets from a feed. Using Abrahams OAuth I've been able to do it, but what I get back is a wall of information. I'm trying to figure out how to decode it and make sense of it so I can work with it (determine if a tweet is a reply or retweet, if its new, if it mentions someone specific, etc). <?php session_start(); require_once("twitteroauth.php"); //Path to twitteroauth library $twitteruser = "user_name_here"; $notweets = 10; $consumerkey = "xxxxxx"; $consumersecret = "xxxxxxx"; $accesstoken = "xxxxxxxxxx"; $accesstokensecret = "xxxxxxxxxxxxxxxxxxx"; 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); $tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets); echo json_encode($tweets); ?> Link to comment https://forums.phpfreaks.com/topic/282174-parsing-twitter-json-request/ Share on other sites More sharing options...
jazzman1 Posted September 16, 2013 Share Posted September 16, 2013 You could use a jquery.getJSON function, to get the content from this JSON object string and display it in readable html format. http://api.jquery.com/jQuery.getJSON/ Link to comment https://forums.phpfreaks.com/topic/282174-parsing-twitter-json-request/#findComment-1449631 Share on other sites More sharing options...
trq Posted September 16, 2013 Share Posted September 16, 2013 Anyone working with Rest API's needs to install postman: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en Link to comment https://forums.phpfreaks.com/topic/282174-parsing-twitter-json-request/#findComment-1449659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.