title: Working example of PHP's __dorequest method for SOAP?
body: <p>I am trying to use the MS Exchange 2007 Web Services from PHP and my first snag (of course) is successfully authenticating to the wsdl file when creating the SoapClient object.</p>
  
  <p>I am able to fetch the WSDL file via curl simply by setting <code>HTTPAUTH</code> and <code>USERPWD</code>:</p>
  
  <pre><code>   $exch = curl_init($exch_url);
     curl_setopt($exch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($exch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
     curl_setopt($exch, CURLOPT_USERWD, $user.":".$pwd);
  </code></pre>
  
  <p>This was surprisingly easy. But I don't have the option of setting my authentication method in SoapClient (that I know of). I looked at nu_soap, but I don't like some of its core approach and I don't think I need a full library just to get one feature that I know I can get from the above code.</p>
  
  <p>I found two different (almost identical) examples showing how to extend the SoapClient class for Exchange WS, but neither worked or made much sense. The main thing I picked up was that it was using the <code>__dorequest</code> method to modify the Soap request before sending, but the documentation is on php.net is not very realistic or intuitive, so I'm not sure if this method will allow me to simply use curl to authenticate and get the WSDL.</p>
  
  <p>Can anyone demonstrate a clear and simple way to either authenticate via curl first and use the headers for future SoapRequests (including the initial WSDL retrieval) or to extend the class so that it uses the above bit of code for the request?</p>