RSStestpagina

RSS Test Pagina.

Dit is een niet-publieke pagina om de integratie met RSS te testen.

 

[insert_php]
function file_get_contents_curl( $url )
{
$ch = curl_init();

curl_setopt( $ch, CURLOPT_AUTOREFERER, TRUE );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, TRUE );

$data = curl_exec( $ch );
curl_close( $ch );

return $data;
}

echo ‘

‘;
$rss = new DOMDocument();
$rss->loadXML(file_get_contents_curl(‘https://poortkerk.nl/myphp/rssinfo.php’));
$feed = array();
foreach ($rss->getElementsByTagName(‘item’) as $node) {
$item = array (
‘url’ => $node->getElementsByTagName(‘enclosure’)->item(0)->getAttribute(‘url’),
‘title’ => $node->getElementsByTagName(‘title’)->item(0)->nodeValue,
‘desc’ => $node->getElementsByTagName(‘description’)->item(0)->nodeValue,
‘link’ => $node->getElementsByTagName(‘link’)->item(0)->nodeValue,
‘date’ => $node->getElementsByTagName(‘pubDate’)->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 10;
for($x=0;$x<$limit;$x++) { $url = $feed[$x]['url']; $title = str_replace(' & ', ' & ', $feed[$x]['title']); $link = $feed[$x]['link']; $description = $feed[$x]['desc']; $date = date('l F d, Y, H:m', strtotime($feed[$x]['date'])); echo 'image‘;
echo ‘

‘.$title.’
‘;
echo ‘Posted on ‘.$date.’

‘;
echo ‘

‘;
echo ‘

‘.$description.’

‘;
echo ‘

‘;
}
echo “

“;
[/insert_php]