hi, i want to import an xml document and read it but when i do it returns it with the xsl file the xml imports so i the whole outcome where as i just want the xml without it loading the xsl, also i dont no how to parse it.

any help would be much appreciative thanks 😃

<?php
/*
 * (C) Copyright By 2k9lestaa4lyf@live.co.uk
 * Coding For Fun (:
 */


class wow_armory {
	var $Realm = "Nagrand";
	var $User = false;
	var $URL = "http://eu.wowarmory.com/character-sheet.xml?";

function wow_armory (){

}

function GetUSER ($username){
	$this->User = $username;
	$URL = $this->URL . "r={$this->Realm}&n={$this->User}";
	$Xml = file_get_contents($URL);
	return $Xml;
}
}

?>

    2 options:

    1: [man]simplexml[/man]
    2: [man]dom[/man]

      this work but i cant get the xml source it is asif i get the generated source code from the xml&xsl stylesheet

        It could be that there is some sort of content negotiation going on at the target site. You might need to use [man]cURL[/man] and send a header or two that tells it you can accept XML/XSL so that it just sends you the XML file, instead of processing the XSLT on the server and sending you the resulting XHTML.

          Did you send an accept header? Something like:

          curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml, text/xml'));
          

            Maybe it's time to contact the webmaster of that site and see if s/he can help? Perhaps they have an RSS feed you could use, or they can tell you exactly what sort of content negotiation they are using? (Or perhaps they might ask you to keep your paws off their data. 😉 )

              Write a Reply...