title: How to parse SimpleXMLElement in php / Laravel 5?
body: <p>I use Guzzle to make an XML request to an external API in the back-end.</p>
  
  <p>This is where I create the Guzzle client:</p>
  
  <pre><code>$client = new Client(); //GuzzleHttp\Client
  </code></pre>
  
  <p>This is where I make the request:</p>
  
  <pre><code>$request = $client-&gt;request( 'GET', 'This is where I put the URL');
  </code></pre>
  
  <p>This is where I get the Guzzle response and try to parse it:</p>
  
  <pre><code>$xml = $request-&gt;getBody()-&gt;getContents();
  $xml = new \SimpleXMLElement($xml);
  $xml = simplexml_load_string($xml);
  </code></pre>
  
  <p>If I do this:</p>
  
  <pre><code>dd($xml);
  </code></pre>
  
  <p>I receive this in return:</p>
  
  <pre><code>SimpleXMLElement {#240 ▼
    +"StatusCode": "1"
    +"StatusDescription": "Duplicated request"
    +"MerchantId": "***"
    +"Company": "***"
    +"CompanyCity": "***"
    +"CompanyPhone": "***"
    +"CompanyDbaName": "***"
    +"Balance": "99965"
    +"TransDate": "2017-10-07"
    +"TransTime": "06:58:48"
    +"ProductVer": "***"
    +"PromoVer": object
    +"SoftVer": object
    +"InvoiceNumber": object
  }
  </code></pre>
  
  <p>My problem is that I don't know how to parse this. I want to get the <code>1</code> in <code>StatusCode</code>.</p>
  
  <p>If I do this:</p>
  
  <pre><code>dd($xml-&gt;StatusCode);
  </code></pre>
  
  <p>I receive this:</p>
  
  <pre><code>SimpleXMLElement {#242 ▼
    +0: "1"
  }
  </code></pre>
  
  <p>How do I get just <code>1</code> ?</p>