Saturday, March 2, 2013

Get all followers of specify user from Twitter by PHP

3/02/2013

There are many ways for getting Twitter follower count but the simplest of them is by using a simple PHP method explained on this article.

<?php
/* 
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/



$screenName = "4evertutorial"; #user name on twitter
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.twitter.com/1/statuses/user_timeline.json?include_entities=false&include_rts=false&screen_name=$screenName&count=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$curlout = curl_exec($ch);
curl_close($ch);
$response = json_decode($curlout, true);


if(count($response))
{

echo $response[0]['user']['id'];
echo "
"; echo $response[0]['user']['name']; echo "
"; echo $response[0]['user']['screen_name']; echo "
"; echo $response[0]['user']['location']; echo "
"; echo $response[0]['user']['description']; echo "
"; echo $response[0]['user']['followers_count']; echo "
"; echo $response[0]['user']['friends_count']; echo "
"; echo $response[0]['user']['profile_background_image_url']; echo "
"; echo $response[0]['user']['profile_image_url']; } ?>

helpful? Share this

The Editorial Team of 4everTutorials consists of a group of PHP Professionals.

0 comments:

 

© 2014 4everTutorials. All rights resevered.

Back To Top