<php function twitter_user_info($screen_name){ $data = file_get_contents("https://api.twitter.com/1.1/users/lookup.json?screen_name=" . $screen_name); $data = json_decode($data, true); //echo $data; return $data[0]; } $twitter = twitter_user_info("srinuchilukuri"); echo "Followers count: " . $twitter['followers_count']; >
You can retrieve every Twitter info with following snippet:
<php function twitter_user_info($screen_name){ $data = file_get_contents("https://api.twitter.com/1.1/users/lookup.json?screen_name=" . $screen_name); $data = json_decode($data, true); //echo $data; return $data[0]; } $twitter = twitter_user_info("srinuchilukuri"); print_r($twitter); >The above code will give you following output:
Array ( [id] =1336470266 [id_str] =1336470266 [name] =Srinu Chilukuri [screen_name] =srinuchilukuri [location] =Hyderabad [url] =http://knowledgecornor.blogspot.in [description] =Software Engineer [protected] = [followers_count] =11 [friends_count] = 83 [listed_count] = 0 [created_at] =Mon Apr 08 12:00:21 +0000 2013 [favourites_count] = 3 [utc_offset] = 19800 [time_zone] = Chennai [geo_enabled] = [verified] = [statuses_count] = 78 [lang] = en )
No comments:
Post a Comment