Deathwillow Posted April 12, 2009 Share Posted April 12, 2009 So I've been sitting here for a few hours trying to get what I considered an easy script working when I ran into a problem. Currently I'm trying to pull XML information from the www.wowarmory.com website to make an updated roster on a website. I've got the part where I pull the information from the armory fine, the problem I've ran into is making a DOMDocument and being able to use the information in it. Here's the code I've got so far: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.wowarmory.com/guild-info.xml?r=Gorgonnash&n=Midnight%20Reveries&p=1"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"); $armory = curl_exec($ch); curl_close($ch); print_r($armory); $doc = new DOMDocument(); $doc->loadXML($armory); $memberList = $doc->getElementsByTagName("character"); foreach($memberList as $toon) { $data = array( 'NAME' => $toon->getAttribute("name"), 'RACE' => $toon->getAttribute("race"), 'LEVEL' => $toon->getAttribute("level"), 'CLASS' => $toon->getAttribute("class"), 'GENDER' => $toon->getAttribute("gender"), ); echo $data['NAME'] . "<br/>"; } ?> At this point I simply want it to list the name of each character attribute, but can't even get it to do that. I'm not exactly sure what else to check. Suggestions? Errrors on my part? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/153690-solved-domdocuments/ Share on other sites More sharing options...
Deathwillow Posted April 13, 2009 Author Share Posted April 13, 2009 Despite not receiving a reply, I did manage to finally figure out the problem The problem wasn't in the code, it was correct, the problem was server side. DOMDocuments are only supported in PHP 5 and by default, for some stupid reason, my service provider enables PHP 4... so after a few hours they finally managed to update my server to PHP 5 and everything's working how I want it and I'm finally able to move on with my script. Hope it helps anyone else with future issues. Quote Link to comment https://forums.phpfreaks.com/topic/153690-solved-domdocuments/#findComment-808389 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.