ik heb daar een goed script voor dat xerkt,
Om in db te zetten.?
kzalt efkes zoeken en dan posten in deze post
EDIT:
Hier is het script:
je moet de db gegevens wel eventjes aanpassen,
je kan het ook echo'en zoals je wilt enzo...
hf with it
Edit2:
:o Ik bekijk just die .xml, kan zijn dat ge nog wat gaat mogen aanpassen op de atributen waarop hij moet zoeken enzo
<?php
include("./config/connect.php");
mysql_select_db("dbnaam") or die("Could not select db");
$RSS_Content = array();
function RSS_Tags($item, $type)
{
$y = array();
$tnl = $item->getElementsByTagName("title");
$tnl = $tnl->item(0);
$title = $tnl->firstChild->data;
$tnl = $item->getElementsByTagName("link");
$tnl = $tnl->item(0);
$link = $tnl->firstChild->data;
$tnl = $item->getElementsByTagName("description");
$tnl = $tnl->item(0);
$description = $tnl->firstChild->data;
$tnl = $item->getElementsByTagName("pubDate");
$tnl = $tnl->item(0);
$pubDate = $tnl->firstChild->data;
$y["title"] = $title;
$y["link"] = $link;
$y["description"] = $description;
$y["pubDate"] = $pubDate;
return $y;
}
function RSS_Channel($channel)
{
global $RSS_Content;
$items = $channel->getElementsByTagName("item");
// Processing channel
$y = RSS_Tags($channel, 0); // get description of channel, type 0
array_push($RSS_Content, $y);
// Processing articles
foreach($items as $item)
{
$y = RSS_Tags($item, 1); // get description of article, type 1
array_push($RSS_Content, $y);
}
}
function RSS_Retrieve($url)
{
global $RSS_Content;
$doc = new DOMDocument();
$doc->load($url);
$channels = $doc->getElementsByTagName("channel");
$RSS_Content = array();
foreach($channels as $channel)
{
RSS_Channel($channel);
}
}
function RSS_RetrieveLinks($url)
{
global $RSS_Content;
$doc = new DOMDocument();
$doc->load($url);
$channels = $doc->getElementsByTagName("channel");
$RSS_Content = array();
foreach($channels as $channel)
{
$items = $channel->getElementsByTagName("item");
foreach($items as $item)
{
$y = RSS_Tags($item, 1); // get description of article, type 1
array_push($RSS_Content, $y);
}
}
}
function RSS_Links($url, $size)
{
global $RSS_Content;
$page = "<ul>";
RSS_RetrieveLinks($url);
if($size > 0)
$recents = array_slice($RSS_Content, 0, $size);
foreach($recents as $article)
{
$type = $article["type"];
if($type == 0) continue;
$title = $article["title"];
$link = $article["link"];
$page .= "<li><a href=\"$link\">$title</a></li>\n";
}
$page .="</ul>\n";
return $page;
}
function RSS_Display($url, $size)
{
global $RSS_Content;
$opened = false;
$page = "";
RSS_Retrieve($url);
if($size > 0)
$recents = array_slice($RSS_Content, 0, $size);
foreach($recents as $article)
{
$type = $article["type"];
if($type == 0)
{
if($opened == true)
{
$page .="</ul>\n";
$opened = false;
}
$page .="<b>";
}
else
{
if($opened == false)
{
$page .= "<ul>\n";
$opened = true;
}
}
$title = $article["title"];
$link = $article["link"];
$description = $article["description"];
$pubDate = $article["pubDate"];
$date = date("Y-m-d");
$weergeven = "2";
$posted = "krant";
mysql_query("INSERT INTO `nieuws` (`id`,`title`,`posted`,`link`,`description`,`pubDate`,`date`,`weergeven`) VALUES ('','".$title."','".$posted."','".$link."','".$description."','".$pubDate."','".$date."','".$weergeven."')");
$page .= "<li><a href=\"$link\">$title</a>";
if($description != false)
{
$page .= "<br>$description";
}
$page .= "</li>\n";
if($type==0)
{
$page .="</b><br />";
}
}
if($opened == true)
{
$page .="</ul>\n";
}
}
?>
Link gekopieerd
Ik heb die manier ook geprobeerd, maar die werkt ook niet.
Die van tweakers werkt prima, maar die van rtl.nl of nu.nl werkt niet.
<?php
printFeeds('http://feeds.feedburner.com/tweakers/');
//printFeeds('http://www.rtl.nl/service/rss/rtlnieuws/index.xml');
function printFeeds($url)
{
$doc = new DOMDocument();
$doc->load($url);
$channels = $doc->getElementsByTagName("channel");
$RSS_Content = array();
foreach($channels as $channel)
{
$items = $channel->getElementsByTagName("item");
foreach($items as $item)
{
$y = array();
$tnl = $item->getElementsByTagName("title");
$tnl = $tnl->item(0);
$title = $tnl->firstChild->data;
echo $title . "<br>";
}
}
}
?>
Warning: DOMDocument::load(
http://www.rtl.nl/service/rss/rtlnieuws/index.xml ) [function.DOMDocument-load]: failed to open stream: Connection refused in * on line 9
Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://
www.rtl.nl/service/rss/rtlnieuws/index.xml" ; in * on line 9
Link gekopieerd