Getting Twitter Homeline using Prototype

Welcome back m back with a new awesome tutorial about twitter..today in the morning one of my blogger and E-Friend asked me to create a script using which he can easily implement Twitter hometimeline in his one of website. So a hour ago i started working on it and it comes a strong and easy to implement tutorial for others too so we both decided to put it into my blog too..okay then without wasting your time i am going to show u the codes use these as it they are..

demo.php
<br /> <script type="text/javascript" src="prototype.js"></script> <br /> <script> function sendRequest() { new Ajax.Request("get_homeline.php", { method: 'post', postBody: 'twitteruser='+ $F('twitteruser'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script><br /> <br /> <form id="test" onSubmit="return false;"><input type="text" name="twitteruser" id="twitteruser" /><br /> <input type=submit value="Submit" onClick="sendRequest()"><br /> <img id="load" src="loading.gif" style="display:none" /><br /> <br /> <br /> <div id="show"></div></form>
get_homeline.php


$content=file_get_contents("http://search.twitter.com/search.json?q=from%3A".$_POST['twitteruser']."");
$new=json_decode($content);
echo "<table>"; foreach($new->results as $homelines) { 	echo "
<tr style='border-bottom:1px dashed #bbcedc'><td><img src="&quot;.$homelines-&gt;profile_image_url.&quot;"></td><td>".$homelines->text."</td></tr>
"; } echo "</table>";



here we go but before this you must be having prototype.js with you any ways if you don't want to copy and paste these code you can also download these from here
http://www.box.net/shared/bg09oxuhfn

Comments

  1. I'm working with Twitter Oauth related to following post.

    http://www.9lessons.info/2010/02/connect-twitter-api-with-oauth-using.html

    ReplyDelete

Post a Comment

Popular posts from this blog

Execute Simple MySql Queries in Joomla

What Is Bitcoin? 10 Facts You Should Know