Inserting Multiple Rss Feeds Into MYSQL With Simplexml
Inserting Multiple Rss Feeds Into MYSQL With Simplexml
(https://www.facebook.com/share.php?u=http://techqa.info/programming/question/10268986
/inserting-multiple-rss-feeds-into-mysql-with-simplexml&title=Inserting multiple rss feeds into
MYSQL with simplexml - php - mysql - xml - rss - simplexml)
(https://reddit.com/submit?url=http://techqa.info/programming/question/10268986/inserting-
multiple-rss-feeds-into-mysql-with-simplexml&title=Inserting multiple rss feeds into MYSQL with
simplexml - php - mysql - xml - rss - simplexml)
(https://twitter.com/share?url=http://techqa.info/programming/question/10268986/inserting-
multiple-rss-feeds-into-mysql-with-simplexml&text=Inserting multiple rss feeds into MYSQL with
simplexml)
(https://plus.google.com/share?url=http://techqa.info/programming/question/10268986
/inserting-multiple-rss-feeds-into-mysql-with-simplexml)
(https://vk.com/share.php?url=http://techqa.info/programming/question/10268986/inserting-
multiple-rss-feeds-into-mysql-with-simplexml)
(https://service.weibo.com/share/share.php?url=http://techqa.info/programming/question
/10268986/inserting-multiple-rss-feeds-into-mysql-with-simplexml)
(https://www.linkedin.com/shareArticle?url=http://techqa.info/programming/question
/10268986/inserting-multiple-rss-feeds-into-mysql-with-simplexml)
(https://www.xing.com/app/user?op=share&url=http://techqa.info/programming/question
/10268986/inserting-multiple-rss-feeds-into-mysql-with-simplexml)
Below is my code to parse multiple rss feeds into a mysql db. I do something wrong in the
foreach part I think, since there is no output. The db however, gets filled. When using 1
feed, the script works fine. Anybody sees what I do wrong? Many thanks in advance :)
1 of 4 05/16/2017 10:25 AM
Inserting multiple rss feeds into MYSQL with sim... http://techqa.info/programming/question/1026898...
foreach($xml->channel->item as $item)
{
$date_format = "j-n-Y"; // 7-7-2008
echo date($date_format,strtotime($item->pubDate));
echo '<a href="'.$item->link.'" target="_blank">'.$item->title.'</a>';
echo '<div>' . $item->description . '</div>';
1 Answers
Try this:
2 of 4 05/16/2017 10:25 AM
Inserting multiple rss feeds into MYSQL with sim... http://techqa.info/programming/question/1026898...
<?php
$feeds = array('https://www.ictu.nl/rss.xml', 'http://www.vng.nl/smartsite.dws?id
=97817');
foreach( $feeds as $feed ) {
$xml = simplexml_load_file($feed);
foreach($xml->channel->item as $item)
{
$date_format = "j-n-Y"; // 7-7-2008
echo date($date_format,strtotime($item->pubDate));
echo '<a href="'.$item->link.'" target="_blank">'.$item->title.'</a>
';
echo '<div>' . $item->description . '</div>';
Hope it helps.
3 of 4 05/16/2017 10:25 AM
Inserting multiple rss feeds into MYSQL with sim... http://techqa.info/programming/question/1026898...
4 of 4 05/16/2017 10:25 AM