PHP feeds in PHP

Just wondering if anyone can suggest a PHP library that will allow me to read the RSS feed data and write it to the MySQL database. Also, if possible, provide a link to the documentation on how to do this?

thanks

+5
source share
6 answers

RSS is a fairly simple format - there is no need to use a separate library.

I would just use simplexml , because I don’t want to spend efforts on studying another library and watching its development.

Here is a simple PHP script to display the latest Stackoverflor posts using simplexml:

<?php
$rss = simplexml_load_file('http://stackoverflow.com/feeds');
?>
<h1><?php echo $rss->title; ?></h1>
<ul>
<?php
foreach($rss->entry as $e) {
    echo "<li><a href=\"".$e->link['href']."\">";
    echo $e->title; 
    echo "</a></li>\n";
}    
?>
</ul>
+10
source

Simplepie, , RSS RSS.

+3

, - , simplexml .

http://www.ibm.com/developerworks/library/x-simplexml.html

, , .

Gotchas: rss (. tut) rss ( ) rss - allow_url_fopen - , cURL

+2

SimplePie - , , . RSS- . , , .

+1

Magpie - RSS

http://magpierss.sourceforge.net/

: http://www.olate.co.uk/articles/view.php?id=214

Once you use Magpie to grab the RSS feed, you can save it in the save line in DB, just like with any other line.

0
source

You can also give XPath a try, quite easy to use.

0
source

All Articles