note 105194 deleted from soapclient.soapclient by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Aug 2011 14:56:11 +0000 |
| Subject: | note 105194 deleted from soapclient.soapclient by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182106@lists.php.net to get a copy of this message | ||
Note Submitter: gcleaves at gcleaves dot com
----
I was able to connect to SharePoint web services with NTLM by following these instructions:
http://www.php.net/manual/en/soapclient.soapclient.php#97029
http://davidsit.wordpress.com/2010/02/23/reading-a-sharepoint-list-with-php/
However, I needed modify the callCurl function from the first link above to look like this:
<?php
protected function callCurl($url, $data) {
$handle = curl_init();
curl_setopt($handle, CURLOPT_HEADER, false);
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_FAILONERROR, true);
curl_setopt($handle, CURLOPT_HTTPHEADER, Array('Content-type: text/xml',"PHP
SOAP-NTLM Client") );
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($handle, CURLOPT_USERPWD, 'xyz:123');
//curl_setopt($handle,
CURLOPT_PROXYUSERPWD,$this->proxy_login.':'.$this->proxy_password);
//curl_setopt($handle, CURLOPT_PROXY, $this->proxy_host.':'.$this->proxy_port);
//curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
$response = curl_exec($handle);
if (empty($response)) {
throw new
SoapFault($url.':'.$this->proxy_login.':'.$this->proxy_password.' -
CURL error: '.curl_error($handle),curl_errno($handle));
}
curl_close($handle);
return $response;
}
?>
Instead of doing NTLM for proxy authentication, we use NTML for HTTP authentication. But you still
need to store the WSDL file locally as per the second link's instructions.