0

I've got a XML file on the net which I'm trying to split up into variables and display to the user.

This is the url to the file: http://www.labs.skanetrafiken.se/v2.2/querypage.asp?inpPointFr=lund&inpPointTo=ystad

This now seems VERY easy to do from what I've read but the only thing I've gotten to work is this.

$xml = new SimpleXMLElement($url, null, true);
echo $xml->asXML(); // this spits out a huuuge string.

Nothing else has worked. Not simplexml_load_string() or any of the other things.

I've read about 20-40 tutorials and none have worked, getting abit frustrated so to speak.

basickarl
  • 37,187
  • 64
  • 214
  • 335
  • For a URL, you need `simplexml_load_file()`. – nickb Aug 07 '12 at 13:37
  • I just tried: "$xml = simplexml_load_file($url); var_dump($xml);" And got the output = "object(SimpleXMLElement)#1 (0) { } " – basickarl Aug 07 '12 at 13:43
  • Yeah, you have a SimpleXMLElement object - Now you have to parse it. – nickb Aug 07 '12 at 13:45
  • I did this now: "$xml = new SimpleXMLElement($url, null, true); $obj = simplexml_load_file($xml); var_dump($obj);" And got the output = "bool(false)" – basickarl Aug 07 '12 at 13:47
  • Tried also: "$xml = new SimpleXMLElement($url, null, true); $obj = simplexml_load_string($xml); var_dump($obj);" And got the output = "bool(false)" – basickarl Aug 07 '12 at 13:52
  • 1
    possible you can reference `http://stackoverflow.com/questions/4194489/how-to-parse-soap-xml` – Giberno Aug 07 '12 at 13:59
  • Still struggling, SOAP stuff just ain't working either for me! – basickarl Aug 07 '12 at 15:09
  • Just answered my own question here: http://stackoverflow.com/questions/11861081/php-how-to-link-soap-xml-with-xml-schema-xsd/11863994#11863994 – basickarl Aug 08 '12 at 12:00

0 Answers0