How to use NTLM authentication with NuSOAP?

sugarcrmdevelopers —  July 11, 2012

For a couple of weeks I’ve been implementing Webservices to feed resources on a SugarCRM project that I’m working on. As you may know SugarCRM provides NuSOAP, which is a SOAP Toolkit for PHP that brings some extra functionalities to SOAP implementation provided by PHP.

Today I had to use NTLM authentication method, unfortunately it isn’t supported by NuSOAP yet, but I’ve found that if you combine cURL with NuSOAP you can get through without a problem.

So here is the solution I came up with:


$wsdl = 'http://project/file.php?wsdl';

$client = new nusoap_client($wsdl, true);
$client->setCredentials('', '', 'ntlm');
$client->setCurlOption(CURLOPT_USERPWD, 'auth_username:auth_password');