<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace App\Utils\Ntlm;
use SoapClient;
use App\Entity\Vars;
/**
* Description of NTLMSoapClient
*
* @author caldero
*/
class NTLMSoapClient extends SoapClient {
private $__last_request_headers;
function __doRequest($request, $location, $action, $version,$one_way=0) {
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'User-Agent: PHP-SOAP-CURL',
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "'.$action.'"',
);
$this->__last_request_headers = $headers;
$ch = curl_init($location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
//curl_setopt($ch, CURLOPT_USERPWD, USERPWD);
curl_setopt($ch, CURLOPT_USERPWD, Vars::USERNTLM.":".Vars::PASSUSERNTLM);
$response = curl_exec($ch);
return $response;
}
function __getLastRequestHeaders() {
return implode("\n", $this->__last_request_headers)."\n";
}
}