Note that there are some explanatory texts on larger screens.

plurals
  1. POsimpleXML - cant figure out how to get elements
    primarykey
    data
    text
    <p>Thanks for looking ... I have never used an API before and am stuck. Here is the XML that comes back from the API (changed the values as i dont think it should be public)</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;epp xmlns="urn:ietf:params:xml:ns:epp-1.0"&gt; &lt;response&gt; &lt;result code="1000"&gt; &lt;msg&gt;Command completed successfully&lt;/msg&gt; &lt;/result&gt; &lt;resData&gt; &lt;ext-support:lstData xmlns:ext-support="http://www.apitest.co.uk/whapi/ext-support-2.0"&gt; &lt;ext-support:categoryGroup name="Main Category Name"&gt; &lt;ext-support:category id="1"&gt;Support item 1&lt;/ext-support:category&gt; &lt;ext-support:category id="2"&gt;Support item 2&lt;/ext-support:category&gt; &lt;/ext-support:categoryGroup&gt; &lt;ext-support:categoryGroup name="Another Category Name"&gt; &lt;ext-support:category id="5"&gt;Another Support item 1&lt;/ext-support:category&gt; &lt;ext-support:category id="6"&gt;Another Support item 2&lt;/ext-support:category&gt; &lt;/ext-support:categoryGroup&gt; &lt;/ext-support:lstData&gt; &lt;/resData&gt; &lt;/response&gt; &lt;/epp&gt; </code></pre> <p>I am using;</p> <pre><code> $xml = new SimpleXMLElement($returned_xml); </code></pre> <p>but cant figure out how to get at the data inside the object.</p> <p>I basically want to loop through this so I end up with</p> <pre><code> Main category name Support item 1 (id:1) Support item 2 (id:2) Another category name Another support item 1 (id:5) Another support item 2 (id:6) </code></pre> <p>Any help would be much appreciated</p> <p>Thank you</p> <p>Jason</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload