kiowa_jackson Posted July 21, 2009 Share Posted July 21, 2009 I use rsslib http://www.2rss.com/software.php to display rss feeds in my site. I’d like to display a twitter feed on my page, but it doesn’t seem to work. However, I used rss mixer http://www.rssmix.com/ to convert the twitter feed to xml and then it worked properly. However, the site runs veeery slow like this, and now I can't get rssmixer to work and therefore all my feeds are broken. Is there a way to convert the twitter feed to xml? Or is there a different script to use for displaying twitter feeds? Thanks Quote Link to comment Share on other sites More sharing options...
dzelenika Posted July 21, 2009 Share Posted July 21, 2009 I use rsslib http://www.2rss.com/software.php to display rss feeds in my site. I’d like to display a twitter feed on my page, but it doesn’t seem to work. However, I used rss mixer http://www.rssmix.com/ to convert the twitter feed to xml and then it worked properly. However, the site runs veeery slow like this, and now I can't get rssmixer to work and therefore all my feeds are broken. Is there a way to convert the twitter feed to xml? Or is there a different script to use for displaying twitter feeds? Thanks You don't need to convert RSS feed to XML. RSS Feed is XLS try to see source of feed in browser. Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted July 21, 2009 Author Share Posted July 21, 2009 OK, my problem is that the feed http://search.twitter.com/search.atom?q=twitter+feed won't display with rsslib. How do I get that feed to display in a webpage? Thanks Quote Link to comment Share on other sites More sharing options...
dzelenika Posted July 22, 2009 Share Posted July 22, 2009 this is example how to fetch data from xml. (title of first entry) $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); echo $rss->entry[0]->title; Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted July 22, 2009 Author Share Posted July 22, 2009 dzelenika, awesome, thanks so much!! That's a very easy script to use too. Is there way to make it display multiple entries? I tried doing $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); echo $rss->entry[0]->title; $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); echo $rss->entry[1]->title; $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); echo $rss->entry[2]->title; i.e. enter the script multiple times and increase "entry" by 1. It works, but is that a good way to do it or is there a better way? Thanks again Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted July 22, 2009 Author Share Posted July 22, 2009 Started doing it like this now, pretty happy with it. Unless there's some obvious way to make it better I'll go with this: <?php $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); echo "<p>"; echo $rss->entry[0]->title; echo "<p>"; echo $rss->entry[1]->title; echo "<p>"; echo $rss->entry[2]->title; echo "<p>"; echo $rss->entry[3]->title; echo "<p>"; echo $rss->entry[4]->title; ?> </p> Quote Link to comment Share on other sites More sharing options...
dzelenika Posted July 22, 2009 Share Posted July 22, 2009 you should use a loop <?php $xmlStr = file_get_contents('http://search.twitter.com/search.atom?q=twitter+feed'); $rss = new SimpleXMLElement($xmlStr); for($i=0;$i<5;$i++){ echo "<p>"; echo $rss->entry[$i]->title; echo "<p>"; } ?> </p> Quote Link to comment Share on other sites More sharing options...
kiowa_jackson Posted July 23, 2009 Author Share Posted July 23, 2009 Thanks!! Works great Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.