cursed Posted November 3, 2009 Share Posted November 3, 2009 Hey all, So I came across some code on the internet that can extract something from x to y. function SimMyExtract($string, $openingTag, $closingTag) { $string = trim($string); $start = intval(strpos($string,$openingTag) + strlen($openingTag)); $end = intval(strpos($string,$closingTag)); if($start == 0 || $end ==0) return false; // not found $mytext = substr($string,$start, $end - $start); return $mytext; } This works fine if I want it to extract something like <div id="a"> content </div>, but I'm not sure how to get it to do something along the lines of <div id="a"><div id="b">content</div>more content</div> Thanks in advance for your help. Quote Link to comment https://forums.phpfreaks.com/topic/180179-solved-extracting-content-between-divs/ Share on other sites More sharing options...
.josh Posted November 3, 2009 Share Posted November 3, 2009 DOM Quote Link to comment https://forums.phpfreaks.com/topic/180179-solved-extracting-content-between-divs/#findComment-950518 Share on other sites More sharing options...
cursed Posted November 4, 2009 Author Share Posted November 4, 2009 Ahh, thanks. Google is my friend Quote Link to comment https://forums.phpfreaks.com/topic/180179-solved-extracting-content-between-divs/#findComment-950675 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.