ludo1960 Posted February 10, 2019 Share Posted February 10, 2019 Hi guys, I am usingĀ this dom parser, and its pretty easy to find all links on a page then following the links to sub pages, but how do I know when to stop, i.e.when the page has no more children? I came across this script for dealing with child pages, but needless to say it outputs nothing: $links = $html->find('div.layout'); foreach ($links as $link) { foreach ($link->children() as $children) { if ($children->tag == 'a') { $output [] = $children->plaintext; //or whatever you want } } } How do I test for a link that has no more children? Quote Link to comment https://forums.phpfreaks.com/topic/308302-php-simple-dom-find-all-children/ 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.