Ik ben al een tijd bezig om een rss feed op mijn site te plaatsen, echter krijg ik alleen de afbeelding niet uitgelezen, de rest werkt perfect.
Ik weet niet of ik nu het juiste forum onderdeel heb gekozen, mocht het niet de goede zijn dan heb ik dat niet met opzet gedaan :)
De code die ik heb is:
<?php
// Vanaf hier niets meer wijzigen
$datumnu = date("Y-m-j G:i:s");
$datumnucompleet = strtotime("$datumnu");
$userid = "6";
$username = "cron";
$feed_url = "http://www.pzc.nl/cmlink/1.2307321";
$punt = ".";
$usertotal = $userid.$punt.$username;
// Load XML.
$xml = simplexml_load_file($feed_url);
// How many items to display from the RSS Feed ...
$count = 1;
// Grabbing the NameSpace URI for "itms" and "content" ...
foreach ($xml->channel->item as $item) {
$ns_content = $item->children('http://purl.org/rss/1.0/modules/content/');
if($count > 0){
$item_id = md5($item->title);
// $item_date = date("Y-m-j G:i:s", strtotime($item->pubDate));
// $item_date = strtotime($item->pubDate);
$item_date = $datumnucompleet;
$titel = $item->title;
$content = $item->description;
echo "<a href='{$item->link}'>view it</a>";
echo $item_date;
echo "<br>";
echo $titel;
echo "<br>";
echo $content;
// Does record already exist? Only insert if new item...
include '../e107_config.php';
$db_hostname = $mySQLserver;
$db_username = $mySQLuser;
$db_password = $mySQLpassword;
$db = mysql_connect($db_hostname,$db_username,$db_password);
if (!$db)
{
die("Could not connect: " . mysql_error());
}
mysql_select_db($mySQLdefaultdb, $db);
$content = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $content);
$content = str_replace(array("'"), '"', $content);
$titel = iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $titel);
$titel = str_replace(array("'"), '"', $titel);
$item_exists_sql = "SELECT news_title FROM e107_news where news_title = '" . $titel . "'";
$item_exists = mysql_query($item_exists_sql, $db);
if(mysql_num_rows($item_exists)<1)
{
echo "<font color=green>Inserting new item..</font><br/>";
// $item_insert_sql = "INSERT INTO e107_forum_t set thread_name = '$titel', thread_thread = '$content', thread_forum_id = '$forumid', thread_datestamp = '$item_date', thread_user = '$usertotal', thread_active = '1', thread_lastpost = '$item_date'";
// $insert_item = mysql_query($item_insert_sql, $db);
// $item_update_sql = "UPDATE e107_forum set forum_lastpost_user = '$usertotal', forum_lastpost_info = '$item_date', forum_threads = forum_threads + '1' WHERE forum_id = '$forumid'";
// $update_item = mysql_query($item_update_sql, $db);
// $item_update2_sql = "UPDATE e107_user set user_currentvisit = '$item_date', user_forums = user_forums + '1' WHERE user_id = '$userid'";
// $update2_item = mysql_query($item_update2_sql, $db);
}
else
{
echo "<font color=blue>Not inserting existing item..</font><br/>";
}
}else{
Return;
}
$count--;
}
?>
Iemand enig idee wat de code is voor het uitlezen van de afbeeling?
Ik heb al heel veel gezocht op google maar geen oplossing kunnen vinden.