Ninjakreborn Posted December 15, 2010 Share Posted December 15, 2010 This doesn't work. Based off what I have seen online, it is suppose to. Basically, this is what I tried, and the quote is what was returned. I have no idea how to get this to work. It should have been pretty standard based off of the PHP documentation. The Xpath idea I got from someone else. Either way if I try to use find element by id or tag name it still returns an empty array, no matter what. Any advice on what I am doing wrong is appreciated. It doesn't matter what URL I try, none of them seem to work. <?php $school_data = file_get_contents('http://www.infotechnologist.biz'); $doc = new DOMDocument(); $doc->validateOnParse = true; $doc->loadHTML($school_data); $xpath = new DOMXPath($doc); $tags = $xpath->query('div'); echo '<pre>'; print_r($tags); echo '</pre>'; ?> DOMNodeList Object ( ) Quote Link to comment https://forums.phpfreaks.com/topic/221802-errors-with-dom-handling/ Share on other sites More sharing options...
Ninjakreborn Posted December 15, 2010 Author Share Posted December 15, 2010 I tried using that extensively as well as tried many things with HTML Simple Dom. The stuff I am trying to do doesn't seem to be working here. Is it easier/better to parse HTML using Regex and getting what you need as you need it from the pages instead? Quote Link to comment https://forums.phpfreaks.com/topic/221802-errors-with-dom-handling/#findComment-1147868 Share on other sites More sharing options...
BlueSkyIS Posted December 15, 2010 Share Posted December 15, 2010 Regex is the way i do it. Quote Link to comment https://forums.phpfreaks.com/topic/221802-errors-with-dom-handling/#findComment-1147869 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.