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! Quote 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 Quote 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 =\ Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/142719-help-with-gzfile/#findComment-748108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.