RSS feed working fine in localhost but does not work on the server



I m working on a website which extracts news feed from my blog to the website. It workd fine in my localhost but when the content is online, the same code does not work. Here are my code and here is the link for the website here...



<?php
$i = 0; // counter
$j=0;
$des="";
$url = "http://ift.tt/1tORP9u"; // url to parse
$rss = simplexml_load_file($url); // XML parser
$dater=array();
$mylink=array();
$mytitle=array();
// RSS items loop

print '<h2><img style="vertical-align: middle;" src="'.$rss->channel->image->url.'" /> '.$rss->channel->title.'</h2>'; // channel title + img with src

foreach($rss->channel->item as $item) {
if ($i < 8) { // parse only 10 items
//print $item->pubDate;
$mylink[$i]=$item->link;
$mytitle[$i]=$item->title;
$dater[$i]=$item->pubDate;
}



$i++;
}
print '<a href="'.$item->link[0].'" target="_blank">'.$item->title[1].'</a><br />';

//print $dater[1];


?>


Here is the code where i want to print the date



<div class="list-group">

<div class="media list-group-item">


<a class="pull-left" href="news-events.html">
<img class="media-object" src="images/stree2.jpeg" alt="...">
</a>
<div class="media-body">
<a href="news-events.html">

<h4 class="list-group-item-heading">Somae's Story <span class="news-date"><?php echo $dater[0]; ?></span></h4>
<p class="list-group-item-text">Lorem ipsum doner mata coma, orem ipsum doner mata coma, Lorem ipsum.</p>
</a>
</div><!-- end of media-body -->
</div><!-- end of media list-group-item -->

</div><!-- end of list-group -->

</div><!-- end of side-box -->
</div>

No comments:

Post a Comment