<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <div> <pre> <?php include "class.php"; fetch_news("http://shiftdelete.net/rss","images/rss/shiftdelete.jpg","www.shiftdelete.net"); ?> </pre> </div> <body> </body> </html>
<?php include "../dbconfig.php"; function fetch_news($xml){ $data = file_get_contents($xml); $data = simplexml_load_string($data); $articles = array(); foreach($data->channel->item as $item){ $articles[$i] = array( (string)$item->title, (string)$item->description, (string)$item->link, (string)$item->pubDate, ); $sorgu = mysql_query("insert into rss (title,description,link,pubdate) values ('$item->title','$item->description','$item->link','$item->pubDate')"); } //print_r($articles); } ?>