cooldude832 Posted November 13, 2007 Share Posted November 13, 2007 any ideas? Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/ Share on other sites More sharing options...
AndyB Posted November 13, 2007 Share Posted November 13, 2007 explode() (with <body> as the delimiter) and take the second array element would be my approach. Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/#findComment-390409 Share on other sites More sharing options...
cooldude832 Posted November 13, 2007 Author Share Posted November 13, 2007 i did this, but I want to get the trail of the body tag out of there also $data = explode("<body",$data); $data = explode("</body>",$data[1]); print_r($data[0]); Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/#findComment-390414 Share on other sites More sharing options...
cooldude832 Posted November 13, 2007 Author Share Posted November 13, 2007 what about a preg_split()? if i can just find hte match Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/#findComment-390422 Share on other sites More sharing options...
AndyB Posted November 13, 2007 Share Posted November 13, 2007 I don't do regex, but I do know explode can do what you ask (well, explode twice can). $data = explode("<body>",$data); $data = explode("</body>",$data[1]); print_r($data[0]); Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/#findComment-390436 Share on other sites More sharing options...
cooldude832 Posted November 13, 2007 Author Share Posted November 13, 2007 that only works if the body is a pure body tag, I need a much more universal, also it fails to match <BODY> or <Body onload="dothis"> see what I mean, I think regex is the answer here Link to comment https://forums.phpfreaks.com/topic/77089-how-can-i-remove-all-data-in-a-file-above-the-tag/#findComment-390439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.