_custom_params = $value; } parent::__construct($url, $params); } function __doRequest($request, $location, $action, $version, $one_way = NULL) { $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); if ( $this->_custom_params['fix_ms_soap'] ) $request = $this->fix_ms_xml($request); 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); $response = curl_exec($ch); return $response; } function __getLastRequestHeaders() { return implode("\n", $this->__last_request_headers)."\n"; } function fix_ms_xml($request,$level=1){ $out=''; $dom = new DOMDocument(); $dom->loadXML($request, LIBXML_NOBLANKS); $envelopes = $dom->getElementsByTagName('Envelope'); foreach($envelopes as $envelope){ foreach ( $this->_custom_params['fix_ms_soap'] as $remove_namespace ) { if($envelope->hasAttribute("xmlns:" . $remove_namespace)){ $attr1 = (String)$envelope->getAttribute("xmlns:" . $remove_namespace); $envelope->removeAttributeNS($attr1,$remove_namespace); } } } return $dom->saveXML(); } }