Syber Blog - Your Source 4 All Web 2.0

Display Twitter Followers as Text – Syberplanet API

Posted by Syberplanet on May 28th, 2009 - 1,191 views

Syberplanet Twitter API

Making the Call

http://api.syberplanet.net/twitter/?u=Twitter+Username

Input Variables

Username - u
Output - output

Output Types

  • Text
  • Javascript

Simple Example

http://api.syberplanet.net/twitter/?u=Syberplanet&output=text

This Will Return “88″ which can be accessed through php.

Simple HTML Example

<script type="text/javascript" src="http://api.syberplanet.net/twitter/?u=Syberplanet&output=js"></script>
<h2>Visit Us On Twitter</h2>

<p>
Join the <b><script type="text/javascript" src="http://api.syberplanet.net/twitter/?u=Syberplanet&output=js"></script></b> people who follow Syberplanet and receive our updates
</p>

Using PHP To embed twitter count

<?php

$username = “Syberplanet”; // Your twitter username
$output = “text”; // text or js
$url = “http://api.syberplanet.net/twitter/?u=$username&output=$output;

$followers = file_get_contents($url);

echo $followers;

?>

The Javascript output can be used anywhere and all the CSS properties applied to the tag its contained is will show on the twitter count. The javascript access does not require any PHP or any other server requirements and can be used on any site or blog.

The PHP code simply gets the contents of the API page (Followers) and embeds it wherever the code is placed. The PHP can be used by just adding < ?php echo $followers; ?> to the site that runs apache.

If you enjoyed this post, make sure you subscribe to our RSS feed!


3 Responses to “Display Twitter Followers as Text – Syberplanet API”

  1. Can you give me the php that your using to get the followers count? I need it to be on my clients server.


  2. Hello Derek,
    Sorry, we can’t give out the code that makes this service. You are free to use it and if you think this site might shut down and affect your client, we assure that we will email you before anything like this happens.

    Our code is slightly better than this one, but I think this is enough to get you started. http://tinyurl.com/8s69hc

    Syberplanet


  3. Thanks very much. I just implemented it on my blog (WordPress 2.8) and it works flawlessly!


Leave a Reply


Advertise on Syber Blog
Earn $$ with WidgetBucks!