Background: I am writing a PHP piece of code, which is connecting to another party using RESTful API's. I'm using Laravel 4.2, PHP5.5, and using Guzzle as the client.
Currently I am trying to get some data via the API, which returns an XML object.
Code:
public function getCategories()
{
    $client = new Guzzle();
    $req = $client->createRequest('get', $this->api_url."cateservice/category", [
        'headers'=> [
            'Content-type'      => 'application/xml',
            'Accept-charset'    => 'utf-8',
            'openapikey'        => $this->api_key
        ]
    ]);
    $xml = $client->send($req)->getBody();
}
If I were to run simplexml_load_string($xml), it returns a completely empty object. Same goes if I were to use Guzzle's default ->xml() function.
Using the browser, I managed to get the suppposed response body as such:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:categorys 
    xmlns:ns2="http://skt.tmall.business.openapi.spring.service.client.domain">
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>test middle2</dispEngNm>
        <dispNm>test middle2</dispNm>
        <dispNo>1642</dispNo>
        <parentDispNo>1639</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>test small2</dispEngNm>
        <dispNm>test small2</dispNm>
        <dispNo>1643</dispNo>
        <parentDispNo>1642</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>1</depth>
        <dispEngNm>Women Clothing</dispEngNm>
        <dispNm>Women Clothing</dispNm>
        <dispNo>2021</dispNo>
        <parentDispNo>0</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Tops</dispEngNm>
        <dispNm>Tops</dispNm>
        <dispNo>2051</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Sleeveless</dispEngNm>
        <dispNm>Sleeveless</dispNm>
        <dispNo>2209</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Short Sleeve</dispEngNm>
        <dispNm>Short Sleeve</dispNm>
        <dispNo>2210</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>3/4 Sleeve</dispEngNm>
        <dispNm>3/4 Sleeve</dispNm>
        <dispNo>2211</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Long Sleeve</dispEngNm>
        <dispNm>Long Sleeve</dispNm>
        <dispNo>2212</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>T-shirts</dispEngNm>
        <dispNm>T-shirts</dispNm>
        <dispNo>2214</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Shirts</dispEngNm>
        <dispNm>Shirts</dispNm>
        <dispNo>2215</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Blouse</dispEngNm>
        <dispNm>Blouse</dispNm>
        <dispNo>2216</dispNo>
        <parentDispNo>2051</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Dresses</dispEngNm>
        <dispNm>Dresses</dispNm>
        <dispNo>2052</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Mini</dispEngNm>
        <dispNm>Mini</dispNm>
        <dispNo>2217</dispNo>
        <parentDispNo>2052</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Midi</dispEngNm>
        <dispNm>Midi</dispNm>
        <dispNo>2218</dispNo>
        <parentDispNo>2052</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Maxi</dispEngNm>
        <dispNm>Maxi</dispNm>
        <dispNo>2219</dispNo>
        <parentDispNo>2052</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Traditional wear</dispEngNm>
        <dispNm>Traditional wear</dispNm>
        <dispNo>2053</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Kurti</dispEngNm>
        <dispNm>Kurti</dispNm>
        <dispNo>2221</dispNo>
        <parentDispNo>2053</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Cheongsam</dispEngNm>
        <dispNm>Cheongsam</dispNm>
        <dispNo>2222</dispNo>
        <parentDispNo>2053</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Skirts</dispEngNm>
        <dispNm>Skirts</dispNm>
        <dispNo>2054</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Mini</dispEngNm>
        <dispNm>Mini</dispNm>
        <dispNo>2223</dispNo>
        <parentDispNo>2054</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Midi</dispEngNm>
        <dispNm>Midi</dispNm>
        <dispNo>2224</dispNo>
        <parentDispNo>2054</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Maxi</dispEngNm>
        <dispNm>Maxi</dispNm>
        <dispNo>2225</dispNo>
        <parentDispNo>2054</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Pants, Leggings & Shorts</dispEngNm>
        <dispNm>Pants, Leggings & Shorts</dispNm>
        <dispNo>2055</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Pants</dispEngNm>
        <dispNm>Pants</dispNm>
        <dispNo>2227</dispNo>
        <parentDispNo>2055</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Denim</dispEngNm>
        <dispNm>Denim</dispNm>
        <dispNo>2228</dispNo>
        <parentDispNo>2055</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Leggings & Tights</dispEngNm>
        <dispNm>Leggings & Tights</dispNm>
        <dispNo>2229</dispNo>
        <parentDispNo>2055</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Shorts</dispEngNm>
        <dispNm>Shorts</dispNm>
        <dispNo>2230</dispNo>
        <parentDispNo>2055</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Jumpsuits & Playsuits</dispEngNm>
        <dispNm>Jumpsuits & Playsuits</dispNm>
        <dispNo>2056</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Jumpsuits</dispEngNm>
        <dispNm>Jumpsuits</dispNm>
        <dispNo>2231</dispNo>
        <parentDispNo>2056</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Playsuits</dispEngNm>
        <dispNm>Playsuits</dispNm>
        <dispNo>2232</dispNo>
        <parentDispNo>2056</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Outerwear</dispEngNm>
        <dispNm>Outerwear</dispNm>
        <dispNo>2057</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Cardigans</dispEngNm>
        <dispNm>Cardigans</dispNm>
        <dispNo>2233</dispNo>
        <parentDispNo>2057</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Sweaters</dispEngNm>
        <dispNm>Sweaters</dispNm>
        <dispNo>2234</dispNo>
        <parentDispNo>2057</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>3</depth>
        <dispEngNm>Blazers & Coats</dispEngNm>
        <dispNm>Blazers & Coats</dispNm>
        <dispNo>2235</dispNo>
        <parentDispNo>2057</parentDispNo>
    </ns2:category>
    <ns2:category>
        <depth>2</depth>
        <dispEngNm>Muslimah wear</dispEngNm>
        <dispNm>Muslimah wear</dispNm>
        <dispNo>2058</dispNo>
        <parentDispNo>2021</parentDispNo>
    </ns2:category>
Question: How can I parse this piece of XML such that it can become an array, a PHP object, or anything that allows me to access/loop through these "categories"?
EDIT: I am trying to loop through these categories so that I can process and store them into my DB. I'm clueless as to how I can approach this when all the functions are returning either empty objects or empty arrays.
