Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Rss

  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Rss

    Hello,

    Does anyone know if it is possible to get data from an rss feed and "put" it into a MySQL database??

    Thanks

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,100
    Thanks
    2
    Thanked 23 Times in 23 Posts
    I have RSS feeds on my site that read a MySQL database and display the feeds, so I don't know why you couldn't do the reserve and store the data rather than read it.

    Are you talking about scraping feed data off another site or what? You need to supply some details as to where the feed data will be coming from.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    Magpie RSS allows you to provide a URL, and be returned an object representing the RSS feed.
    You can iterate over the result, and insert into the database, something like:
    PHP Code:
    $rss fetch_rss('http://www.google.com/news.rss');
    foreach(
    $rss->items as $item) {
    $query='INSERT INTO news (headline,content,date) VALUES ('
      
    .mysql_real_escape_string($item['title']).','
      
    .mysql_real_escape_string($item['body']).','
      
    .mysql_real_escape_string($item['pubdate'])
    .
    ')';
    mysql_query($query) or die($query.mysql_error());

    Magpie instructions:
    http://magpierss.sourceforge.net/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •