I'm trying to set up a live feed from a blog, but the contents are not displays. Any ideas? The blog is based in WP, I've set a contents curl below to a php file. The php file contains another curl to the physical blog feed.
<?php
try{
// Get RSS feed
$blog_feed = @file_get_contents_curl('http://www.coordsport.com/csblogfeed.php');
if ($blog_feed){
// Convert to traversable XML object
$blog_posts = new SimpleXMLElement($blog_feed);
// Set limits and counter
$list_count = 5;
$current_item = 0;
// Loop through each feed item
foreach ($blog_posts->channel->item as $blog_post)
{
// Increment counter and check count
if (++$current_item > $list_count) break;
// Force data type for description
$post_description = (string)$blog_post->description;
$desc_xml = new SimpleXMLElement('<div>' . $post_description . '</div>');
// Reset thumbnail
$thumbnail_src = '';
if (@$desc_xml->img[0])
{
$thumbnail_src = (string) $desc_xml->img[0]->attributes()->src;
}
}
else
{
echo 'Error Loading Feed';
}
}
catch(Exception $e)
{
echo 'Error Loading Feed.<br /><br /><div style="font-size:75%;color:#ccc;">' . htmlspecialchars($e) . '</div>';
}
?>
The file_get_contents_curl csblogfeed.php contains, the blog is working fine and displays correctly in the below URL.
<?php
echo file_get_contents('http://www.coordsport.com/blog/feed/');
?>