You need to specify the cURL options for the POST and set the request body - if you do not send the body, there is no point in the POST request (and more importantly, this is not SOAP). Building the full header of an HTTP request simply will not reduce it.
$credentials = "username:pass"; $url = "https://url/folder/sample.wsdl"; $body = ''; /// Your SOAP XML needs to be in this variable $headers = array( 'Content-Type: text/xml; charset="utf-8"', 'Content-Length: '.strlen($body), 'Accept: text/xml', 'Cache-Control: no-cache', 'Pragma: no-cache', 'SOAPAction: "customerSearch"' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']); // Stuff I have added curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $credentials); $data = curl_exec($ch);
source share