Jump to content

Strip image tags from a RSS feed


PKENGLISH

Recommended Posts

Hi,

 

I am creating an RSS feed reader in flash and in order to get around the sandbox regulations, I am using a php file to make the feed appear on the local server.  The question I have is before I pass the data to the Flash file is it possible to strip out all the images that might be placed within the feed?  I really dislike how flash's dynamic text fields handles them so I would rather get rid of them completely.

 

I have been looking around at preg_replace but am not sure if that is the solution I should be using or really how to work it.  I am still pretty new with PHP so any help would be greatly appreciated.

 

The code that my current PHP files uses is as follows.

 

<?php

$feedURL = "http://somefeedurl.com/index.xml";

$getFeed = curl_init($feedURL);
$result = curl_exec($getFeed);
curl_close($getFeed);
echo $result;
  
?>

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/71718-strip-image-tags-from-a-rss-feed/
Share on other sites

It seems to echo the exact same feed as i find on the site i got it from.  This is my full code:

 

<?php

$feedURL = "http://www.geekologie.com/index.xml";

$getFeed = curl_init($feedURL);
$result = curl_exec($getFeed);
curl_close($getFeed);
echo str_replace("/<img[^>]+>/i","",$result);
  
?>

 

And this is what comes out as a result: http://www.jeffhirsch.net/RSS/antisandbox.php

 

It seems to completely ignore the str_replace.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.