title: Read an Amazon Cloudfront API Result in PHP
body: <p>I've got a PHP script that submits Invalidation requests to Amazon's Cloudfront via API's.</p>
  
  <p>I can capture the response, but it comes back as text basically looking like this:</p>
  
  <pre><code>HTTP/1.0 201 Created
  Content-Type: text/xml
  Location: https://cloudfront.amazonaws.com/2012-07-01/distribution/distribution ID/invalidation/invalidation ID
  
  &lt;Invalidation xmlns="http://cloudfront.amazonaws.com/doc/2012-07-01/"&gt;
     &lt;Id&gt;IDFDVBD632BHDS5&lt;/Id&gt;
     &lt;Status&gt;InProgress&lt;/Status&gt;
     &lt;CreateTime&gt;2013-04-16T19:37:58Z&lt;/CreateTime&gt;   
     &lt;InvalidationBatch&gt;
        &lt;Paths&gt;
           &lt;Items&gt;
              &lt;Path&gt;/image1.jpg&lt;/Path&gt;
           &lt;/Items&gt;
        &lt;/Paths&gt;
        &lt;CallerReference&gt;20130416090001&lt;/CallerReference&gt;
     &lt;/InvalidationBatch&gt;
  &lt;/Invalidation&gt;
  </code></pre>
  
  <p>I basically just want to grab the status value, and I suppose I could do it via Regex or some string manipulation, but I'm assuming there is a better way to convert the returned data into an object and access it properly.  </p>
  
  <p>I tried:</p>
  
  <pre><code>$dom = new DOMDocument();
  $dom-&gt;loadXML($data);
  </code></pre>
  
  <p>But $data doesn't work because it literally contains the header portion "HTTP/1.0 201..."</p>
  
  <p>Anyone know the proper way to handle this?</p>