title: How to consume a response from a WCF REST web service with PHP
body: <p>I have webservice built in .net that looks something like this:</p>
  
  <pre><code>[ServiceContract]
  public interface IRestService
  {
      [OperationContract]
      [WebGet(UriTemplate = "object/{name}")]
      Object GetObject(string name);
  }
  
  public class api : IRestService
  {
      OSAE.OSAE osae = new OSAE.OSAE("WebService");
  
      public Object GetObject(string name)
      {
          // lookup object 
          OSAEObject OSAEobj = osae.GetObjectByName(name);
          Object obj = new Object();
          obj.Name = OSAEobj.Name;
          obj.Address = OSAEobj.Address;
          obj.Type = OSAEobj.Type;
          obj.Container = OSAEobj.Container;
          obj.Enabled = OSAEobj.Enabled;
          obj.Description = OSAEobj.Description;
  
          return obj;
      }
   }
  </code></pre>
  
  <p>This will give a response that looks like this when I just use a browser to call it:</p>
  
  <pre><code>&lt;Object xmlns="http://schemas.datacontract.org/2004/07/OSAERest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;Address/&gt;
  &lt;Container&gt;SYSTEM&lt;/Container&gt;
  &lt;Description&gt;Email&lt;/Description&gt;
  &lt;Enabled&gt;0&lt;/Enabled&gt;
  &lt;Name&gt;Email&lt;/Name&gt;
  &lt;Properties xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true"/&gt;
  &lt;Type&gt;EMAIL&lt;/Type&gt;
  &lt;/Object&gt;
  </code></pre>
  
  <p>I need to be able to consume this with PHP.  I have tried using Pest (https://github.com/educoder/pest), but I can't get anything to work.  Here is my attempt:</p>
  
  <pre><code>&lt;?php
  require_once 'Includes/PestXML.php';
  $pest = new PestXML('http://localhost:8732/api');
  $things = $pest-&gt;get('/object/email');
  $names = $things-&gt;xpath('//Object/Description');
  while(list( , $node) = each($names)) {
      echo $node,"\n";
  }
  ?&gt;
  </code></pre>
  
  <p>How can I properly consume my web service responses with PHP?</p>