<?php
session_start();
require_once("twitteroauth.php"); //Path to twitteroauth library
$task = $argv[1];
$twitteruser = $argv[2];
$twitterkeyword = $argv[2];
$notweets = $argv[3];
$consumerkey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$consumersecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accesstoken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accesstokensecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
if ($task == "show") {
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);
//if ($task == "show") {
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
echo json_encode($tweets);
//echo $tweets;
}
echo $notweets
?>
[{"created_at":"Sat May 03 16:15:01 +0000 2014","id":462626389251072000,"id_str":"462626389251072000","text":"Ready for travel season? A variety of apps could make tablets the essential travel companion http:\/\/t.co\/Ha0RzAr8Bn http:\/\/t.co\/Xkwfb2Hh64","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":70,"favorite_count":47,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Ha0RzAr8Bn","expanded_url":"http:\/\/intel.ly\/1kwMf49","display_url":"intel.ly\/1kwMf49","indices":[93,115]}],"user_mentions":[],"media":[{"id":462626389146234881,"id_str":"462626389146234881","indices":[116,138],"media_url":"http:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","url":"http:\/\/t.co\/Xkwfb2Hh64","display_url":"pic.twitter.com\/Xkwfb2Hh64","expanded_url":"http:\/\/twitter.com\/intel\/status\/462626389251072000\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":227,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":525,"h":350,"resize":"fit"},"medium":{"w":525,"h":350,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},{"created_at":"Fri May 02 23:45:00 +0000 2014","id":462377247161470977,"id_str":"462377247161470977","text":"Wish your smartphone camera helped you take better selifes? Meet the Zenfone by @ASUS - http:\/\/t.co\/Hu4UVRB8LL http:\/\/t.co\/kVH3CsuEHe","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":50,"favorite_count":55,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Hu4UVRB8LL","expanded_url":"http:\/\/intel.ly\/1kxsoSz","display_url":"intel.ly\/1kxsoSz","indices":[88,110]}],"user_mentions":[{"screen_name":"ASUS","name":"ASUS","id":591646425,"id_str":"591646425","indices":[80,85]}],"media":[{"id":462377247010488322,"id_str":"462377247010488322","indices":[111,133],"media_url":"http:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","url":"http:\/\/t.co\/kVH3CsuEHe","display_url":"pic.twitter.com\/kVH3CsuEHe","expanded_url":"http:\/\/twitter.com\/intel\/status\/462377247161470977\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":222,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":541,"h":353,"resize":"fit"},"medium":{"w":541,"h":353,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}]
$json_data = '[{"created_at":"Sat May 03 16:15:01 +0000 2014","id":462626389251072000,"id_str":"462626389251072000","text":"Ready for travel season? A variety of apps could make tablets the essential travel companion http:\/\/t.co\/Ha0RzAr8Bn http:\/\/t.co\/Xkwfb2Hh64","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":70,"favorite_count":47,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Ha0RzAr8Bn","expanded_url":"http:\/\/intel.ly\/1kwMf49","display_url":"intel.ly\/1kwMf49","indices":[93,115]}],"user_mentions":[],"media":[{"id":462626389146234881,"id_str":"462626389146234881","indices":[116,138],"media_url":"http:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","url":"http:\/\/t.co\/Xkwfb2Hh64","display_url":"pic.twitter.com\/Xkwfb2Hh64","expanded_url":"http:\/\/twitter.com\/intel\/status\/462626389251072000\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":227,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":525,"h":350,"resize":"fit"},"medium":{"w":525,"h":350,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},{"created_at":"Fri May 02 23:45:00 +0000 2014","id":462377247161470977,"id_str":"462377247161470977","text":"Wish your smartphone camera helped you take better selifes? Meet the Zenfone by @ASUS - http:\/\/t.co\/Hu4UVRB8LL http:\/\/t.co\/kVH3CsuEHe","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":50,"favorite_count":55,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Hu4UVRB8LL","expanded_url":"http:\/\/intel.ly\/1kxsoSz","display_url":"intel.ly\/1kxsoSz","indices":[88,110]}],"user_mentions":[{"screen_name":"ASUS","name":"ASUS","id":591646425,"id_str":"591646425","indices":[80,85]}],"media":[{"id":462377247010488322,"id_str":"462377247010488322","indices":[111,133],"media_url":"http:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","url":"http:\/\/t.co\/kVH3CsuEHe","display_url":"pic.twitter.com\/kVH3CsuEHe","expanded_url":"http:\/\/twitter.com\/intel\/status\/462377247161470977\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":222,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":541,"h":353,"resize":"fit"},"medium":{"w":541,"h":353,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}]';
$tweet_data = json_decode($json_data,true);
echo "Name: ".$tweet_data[0][user][name]."<br>";
echo "Created on:".$tweet_data[0][created_at]."<br>";
echo "Tweet: ".$tweet_data[0][text]."<br>";
<?php
session_start();
require_once("twitteroauth.php"); //Path to twitteroauth library
$task = $argv[1];
$twitteruser = $argv[2];
$twitterkeyword = $argv[2];
$notweets = $argv[3];
$consumerkey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$consumersecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accesstoken = "XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accesstokensecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
if ($task == "show") {
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);
//if ($task == "show") {
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
$json_data = json_encode($tweets);
$tweet_data = json_decode($json_data,true);
$nos_of_tweets = count($tweets);
for($i=0;$i<$nos_of_tweets;$i++){
echo "Name: ".$tweet_data[$i][user][name]."<br>";
echo "Created on:".$tweet_data[$i][created_at]."<br>";
echo "Tweet: ".$tweet_data[$i][text]."<br>";
}
//echo json_encode($tweets);
//echo $tweets;
}
//echo $json_data
?>
PHP Notice: Â Use of undefined constant user - assumed 'user' in /home/cmoncada/scripts/gettweets.php on line 35
PHP Notice: Â Use of undefined constant name - assumed 'name' in /home/cmoncada/scripts/gettweets.php on line 35
Name: Intel<br>PHP Notice: Â Use of undefined constant created_at - assumed 'created_at' in /home/cmoncada/scripts/gettweets.php on line 36
Created on:Sat May 03 16:15:01 +0000 2014<br>PHP Notice: Â Use of undefined constant text - assumed 'text' in /home/cmoncada/scripts/gettweets.php on line 37
Tweet: Ready for travel season? A variety of apps could make tablets the essential travel companion http://t.co/Ha0RzAr8Bn http://t.co/Xkwfb2Hh64<br>PHP Notice:  Use of undefined constant user - assumed 'user' in /home/cmoncada/scripts/gettweets.php on line 35
PHP Notice: Â Use of undefined constant name - assumed 'name' in /home/cmoncada/scripts/gettweets.php on line 35
Name: Intel<br>PHP Notice: Â Use of undefined constant created_at - assumed 'created_at' in /home/cmoncada/scripts/gettweets.php on line 36
Created on:Fri May 02 23:45:00 +0000 2014<br>PHP Notice: Â Use of undefined constant text - assumed 'text' in /home/cmoncada/scripts/gettweets.php on line 37
Tweet: Wish your smartphone camera helped you take better selifes? Meet the Zenfone by @ASUS - http://t.co/Hu4UVRB8LLÂ http://t.co/kVH3CsuEHe<br>
PHP Notice: Â Use of undefined constant user - assumed 'user' in /home/cmoncada/scripts/getThis occurs because of the way PHP handles constants, versus the way it handles quoted literal strings in array keys. Â This article explains it. Â See especially the part about time bombs.tweets.php on line 35
<?php // demo/temp_madstylex.php
error_reporting(E_ALL);
/**
* SEE http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28425913.html#a40041192
*
* username
* 'date and time' 'tweet'
*/
// JSON IS ALWAYS UTF-8
echo '<meta charset="utf-8" />' . PHP_EOL;
// TEST DATA FROM THE POST AT EE
$jso = <<<EOD
[{"created_at":"Sat May 03 16:15:01 +0000 2014","id":462626389251072000,"id_str":"462626389251072000","text":"Ready for travel season? A variety of apps could make tablets the essential travel companion http:\/\/t.co\/Ha0RzAr8Bn http:\/\/t.co\/Xkwfb2Hh64","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":70,"favorite_count":47,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Ha0RzAr8Bn","expanded_url":"http:\/\/intel.ly\/1kwMf49","display_url":"intel.ly\/1kwMf49","indices":[93,115]}],"user_mentions":[],"media":[{"id":462626389146234881,"id_str":"462626389146234881","indices":[116,138],"media_url":"http:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmuUP_TIcAEjJnR.jpg","url":"http:\/\/t.co\/Xkwfb2Hh64","display_url":"pic.twitter.com\/Xkwfb2Hh64","expanded_url":"http:\/\/twitter.com\/intel\/status\/462626389251072000\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":227,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":525,"h":350,"resize":"fit"},"medium":{"w":525,"h":350,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},{"created_at":"Fri May 02 23:45:00 +0000 2014","id":462377247161470977,"id_str":"462377247161470977","text":"Wish your smartphone camera helped you take better selifes? Meet the Zenfone by @ASUS - http:\/\/t.co\/Hu4UVRB8LL http:\/\/t.co\/kVH3CsuEHe","source":"<a href=\"http:\/\/www.sprinklr.com\" rel=\"nofollow\">Sprinklr<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2803191,"id_str":"2803191","name":"Intel","screen_name":"intel","location":"\u00dcT: 37.575291,-122.341831","description":"Intel news, views & events about global tech innovation.","url":"http:\/\/t.co\/MYZ7uTo0nG","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/MYZ7uTo0nG","expanded_url":"http:\/\/iq.intel.com","display_url":"iq.intel.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":3072725,"friends_count":1202,"listed_count":9083,"created_at":"Thu Mar 29 07:22:48 +0000 2007","favourites_count":472,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":4808,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/433119978913427457\/_mEcPZWl.jpeg","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/458704019897061377\/GPLhINBv_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2803191\/1398790022","profile_link_color":"0070C5","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"86C6E3","profile_text_color":"444444","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":50,"favorite_count":55,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http:\/\/t.co\/Hu4UVRB8LL","expanded_url":"http:\/\/intel.ly\/1kxsoSz","display_url":"intel.ly\/1kxsoSz","indices":[88,110]}],"user_mentions":[{"screen_name":"ASUS","name":"ASUS","id":591646425,"id_str":"591646425","indices":[80,85]}],"media":[{"id":462377247010488322,"id_str":"462377247010488322","indices":[111,133],"media_url":"http:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/BmqxqAhIgAIalgZ.jpg","url":"http:\/\/t.co\/kVH3CsuEHe","display_url":"pic.twitter.com\/kVH3CsuEHe","expanded_url":"http:\/\/twitter.com\/intel\/status\/462377247161470977\/photo\/1","type":"photo","sizes":{"small":{"w":340,"h":222,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":541,"h":353,"resize":"fit"},"medium":{"w":541,"h":353,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}]
EOD;
// MAKE AN ARRAY/OBJECT FROM THE JSON STRING
$dat = json_decode($jso);
/* ACTIVATE THIS TO VISUALIZE THE DATA
echo '<pre>' . PHP_EOL;
var_dump($dat);
echo '</pre>' . PHP_EOL;
*/
// ITERATE OVER THE ARRAY OF OBJECTS
foreach ($dat as $obj)
{
// EXTRACT THE DATA ELEMENTS WE WANT
$when = $obj->created_at;
$text = $obj->text;
$name = $obj->user->screen_name;
// SHOW THE WORK PRODUCT
echo PHP_EOL;
echo '<p>';
echo $name;
echo '<br>';
echo "$when $text";
echo '</p>';
}
HTH. Â Please post back if you have any questions, ~Ray