headmine Posted January 28, 2009 Share Posted January 28, 2009 I started playing with gzfile using the tutorial on PHP.net <?php $lines = gzfile('somefile.gz'); foreach ($lines as $line) { echo $line; } ?> Is there a way to strip html tags (like <body>, <html> etc) or Even chunks of code like from <head> to </head> from a page you are importing using gzfile? I'm sort of new to php but am familar with ASP so I was thinking it would go something like this <?php $lines = gzfile('file.html'); foreach ($lines as $line) { if ($line == "<body>") { str_replace("<body>", "", $line); } else { echo $line } ?> I know that's wrong because I tried it and it didn't work. =) Thanks in advance for any help! Link to comment https://forums.phpfreaks.com/topic/142719-help-with-gzfile/ Share on other sites More sharing options...
trq Posted January 28, 2009 Share Posted January 28, 2009 strip_tags Link to comment https://forums.phpfreaks.com/topic/142719-help-with-gzfile/#findComment-748106 Share on other sites More sharing options...
premiso Posted January 28, 2009 Share Posted January 28, 2009 strip_tags is the way to go. I believe you can even tell it which ones to or not to strip. Edit: 10 seconds slow =\ Link to comment https://forums.phpfreaks.com/topic/142719-help-with-gzfile/#findComment-748107 Share on other sites More sharing options...
headmine Posted January 28, 2009 Author Share Posted January 28, 2009 Thank you Link to comment https://forums.phpfreaks.com/topic/142719-help-with-gzfile/#findComment-748108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.