New to RSS

Discussion in 'XML & RSS' started by alex57, Nov 5, 2006.

  1. #1
    Hello,

    I need to create a RSS file and then insert the data into a MySQL database. So im double checking if this can be achieved. Firstly create a RSS file in xml. Then use a script like this to insert the data from the feed. What would go in the fetch_rssbrackets, my filename?? or would the file need to be on a webpage first? thanks


    $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());
    }  
    PHP:
     
    alex57, Nov 5, 2006 IP