Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.