title: Parsing a live SOAP data stream with PHP
body: <p>I have a enterprise application that provides a fairly robust API for gathering data.  Currently I am querying each user that I want an update on in a loop every second.  However the new API documentation now provides a live stream of all changes on all users.  I am wondering how I can parse this live data as it comes with php. Here are some details:</p>
  
  <p>The data is requested via  a SOAP request, and I am using PHP to make these requests like this (example of session initiation with a unique ID returned):</p>
  
  <pre><code>//Get a session ID for this user for the shoretel WEBAPI
  $soap_url = 'http://11.11.11.11:8070/ShoreTelWebSDK?wsdl';
  $client = new SOAPClient($soap_url, array( 'proxy_host' =&gt; '11.11.11.11', 'proxy_port' =&gt; 8070, 'trace' =&gt; 1 ) );
  $client = new SoapClient($soap_url);
  
  $header = new SoapHeader('http://www.ShoreTel.com/ProServices/SDK/Web');
  $client-&gt;__setSoapHeaders($header);
  $registered_string = $client-&gt;RegisterClient(array(
                  'clientName' =&gt; '11.11.11.211'
              )); 
  $registered_string = get_object_vars($registered_string);   
  $session =  $registered_string['RegisterClientResult'];
  </code></pre>
  
  <p>The new method allows me to specify a time period.  For example if I would like to get all events for 1 minute the call will initiate, wait one minute, then return all of the events that occured during that minute.  </p>
  
  <p>What I would like to do is grab each event as it occurs, and insert it into a database. Is this something that I can accomplish with PHP, or do I need to look to another language to make this happen?</p>