Здравейте извличам rss новини от калдата http://www.kaldata.com/rosebud/rss.php?catid=3
Използвам този скрипт:
вапроса ми е следния. Как да извличам и снимките от rss
записва ми ги в БД като
Благодаря предварително!
Използвам този скрипт:
Код:
<?php
include "include/conf.php";
$xmlfile = fopen("http://www.kaldata.com/rosebud/rss.php?catid=3", "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,4000000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description>",$filechunks[$i],$desc);
ereg('<enclosure(.*)/>',$filechunks[$i],$image);
$zaglavie = $title[1];
$linkche = $links[1];
$tekst = $desc[1];
$data=time();
$image=$image[1];
$query="SELECT * FROM woroldnews WHERE zaglavie LIKE '$zaglavie'";
$result=mysql_query($query);
$num=mysql_numrows($result);
if($num==0)
{
$query = "INSERT INTO `woroldnews` ( `id` , `zaglavie` , `linkche` , `tekst`, `data`,`image`)
VALUES ( 'NULL', '$zaglavie', '$linkche', '$tekst', '$data', '$image')";
$ok = mysql_query($query);
}
}
?>
записва ми ги в БД като
Код:
url="http://kaldata.com/images/news/logos/avg_intsecurity.gif" type="image/gif"
Благодаря предварително!