i'm trying to loop through an xml object like this …
$xml_url = "http://somdomain.com/frieventexport.php";
$curl = curl_init();
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curl, CURLOPT_URL, $xml_url );
$xml = curl_exec( $curl );
curl_close( $curl );
$document = new DOMDocument;
$document->loadXML( $xml );
var_dump($document);
//echo $document->childNodes[1];
With var_dump
I get this.
object(DOMDocument)#1 (34) { ["doctype"]=> NULL ["implementation"]=> string(22) "(object value omitted)" ["documentElement"]=> NULL ["actualEncoding"]=> NULL ["encoding"]=> NULL ["xmlEncoding"]=> NULL ["standalone"]=> bool(true) ["xmlStandalone"]=> bool(true) ["version"]=> string(3) "1.0" ["xmlVersion"]=> string(3) "1.0" ["strictErrorChecking"]=> bool(true) ["documentURI"]=> NULL ["config"]=> NULL ["formatOutput"]=> bool(false) ["validateOnParse"]=> bool(false) ["resolveExternals"]=> bool(false) ["preserveWhiteSpace"]=> bool(true) ["recover"]=> bool(false) ["substituteEntities"]=> bool(false) ["nodeName"]=> string(9) "#document" ["nodeValue"]=> NULL ["nodeType"]=> int(9) ["parentNode"]=> NULL ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["previousSibling"]=> NULL ["attributes"]=> NULL ["ownerDocument"]=> NULL ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> NULL ["baseURI"]=> NULL ["textContent"]=> string(0) "" }
does anybody know how to extract information out of this and use the single xml-items?
this would be in the xml:
<event>
<titel>Eventtitle</titel>
<datum>07.03.2015</datum>
<von>18:30</von>
<bis>23:00</bis>
<ort>Something</ort>
<referent>BezRKdo</referent>
<veranstalter>Who does it.</veranstalter>
</event>
I don't know how to loop through this dump and extract the information. Kind Regards, Matt