RSS(XML) ile Veritabanına Kayıt Yapma

Bu soru iptal edilmiştir...
Merhaba ardadaşlar..


rss.php
<!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>






class.php
<?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);
}

?>


örneğin 15 tane kayıt olduğu halde veritabanına 9 tane kaydediyor. anlamadım olayı.
Yardımcı olursanız sevinirim.
+0
-0
Cevaba KatılıyorumKatılmıyorum
Cevap Yaz Yorum Yaz Arşivime Ekle Takip Et

Cevaplar

  • veyselkoparal adlı üyenin fotoğrafı
    12 yıl önce yazılmış
    7 cevap - 11 soru
    Başlığı düzeltiyorum. rss yi veritabanına kaydetme.