ludo1960 Posted March 5, 2019 Share Posted March 5, 2019 Hi guys, Just starting to play with PHP Domdocument, only to fail at the very first step: <?php $html = 'test/php/somefile.html' ; if(!empty($html)){ $dom_1 = new domDocument ; $dom_1->loadHTML($html) ; $links = $dom_1->getElementsByTagName('li') ; foreach ( $links as $link) { // echo $link ; echo $link->nodeValue, PHP_EOL; } } ?> When I visit it in a browser I get a WSOD, what am I missing? Link to comment Share on other sites More sharing options...
gw1500se Posted March 5, 2019 Share Posted March 5, 2019 You did not read the documentation. The variable $html is not an HTML string which is what loadHTML expects. You want 'loadHTMLFile' instead. Link to comment Share on other sites More sharing options...
ludo1960 Posted March 5, 2019 Author Share Posted March 5, 2019 oops, all good now. Thanks for pointing me in the right direction, off to play now and I promise to read the manual . Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.