dimanche 28 juin 2015

Remove image in RSS feed (CDATA )

I have a php file that gave me other rss feeds on my website... How can i remove images from the $description implemented as CDATA...?

<?php
 $html = "";
 $url = "http:www.yoursite.com/rss";
 $xml = simplexml_load_file($url);
 for($i = 0; $i < 1; $i++){
     $title = $xml->channel->item[$i]->title;
     $link = $xml->channel->item[$i]->link;
     $description = $xml->channel->item[$i]->description;
     $pubDate = $xml->channel->item[$i]->pubDate;
     $pubDate = strftime("%Y-%m-%d" "%H:%M:%S", strtotime($pubDate));
     //%H shows the pubDate Hour

     $html .= "<h3>$title</h3>";
     $html .= "$description";
     $html .= "<br /><a href='$link'>Weiterlesen</a>";
     $html .= "<br /><br />$pubDate";
}
echo $html;
?>

Aucun commentaire:

Enregistrer un commentaire