Взимане от RSS

explozen

Registered
Някой може ли да ми предостави някакъв примерен код който взима новина от RSS и чрез отварянето на даден файл да се добавя във БД.
 
PHP:
<?php
header('Content-Type: text/html; charset=utf-8'); 
$feeds = ('http://www.mma-bulgaria.com/novini.rss');
$xml = simplexml_load_file($feeds);

foreach($xml->channel->item as $item) {
	mysql_query("INSERT INTO `news` (`id`, `title`, `description`, `link`, `pubdate`) 
	VALUES (
		'', 
		'".mysql_real_escape_string($item->title)."', 
		'".mysql_real_escape_string($item->description=htmlspecialchars(trim($item->description)))."', 
		'".mysql_real_escape_string($item->link)."', 
		'".mysql_real_escape_string($item->pubdate)."')");
}
 

Back
Горе