Jump to content

[SOLVED] How can I dispaly twitter searches as a feed with php? Can I convert to xml?


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.