The PHP NTLM library (php-ntlm) is intended to provide various methods to aid in communicating with Microsoft services that utilize NTLM authentication from within PHP.
- Composer
- PHP 5.4 or greater
- cURL with NTLM support (7.23.0+ recommended)
The preferred installation method is via Composer, which will automatically handle autoloading of classes.
{
"require": {
"jamesiarmes/php-ntlm": "dev-master"
}
}
The \jamesiarmes\PhpNtlm\SoapClient
class extends PHP's built in SoapClient
class and can be used in the same manner with a few minor changes.
- The constructor accepts a required 'user' and 'password' index in the
$options
array. - The constructor accepts an optional 'curlopts' index in the
$options
array that can be used to set or override the default curl options.
Basic example:
$client = new SoapClient(
$wsdl,
array('user' => 'username', 'password' => '12345')
);
Example that skips SSL certificate validation:
$client = new SoapClient(
$wsdl,
array(
'user' => 'username',
'password' => '12345',
'curlopts' => array(CURLOPT_SSL_VERIFYPEER => false),
)
};