title: Send SOAP request using CURL
body: <p>I am sending a soap request using PHP curl(). I need to print my request, so that I can have a look into my request and understand weather it is going in a right format.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$parameters = "&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ejb='http://ejb.gateway.ebpp.fawryis.com/'&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;ejb:process&gt;
  //... 
        &lt;/ejb:process&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;";
  
  
  $url='//URL to the service';
  $curl = curl_init();
  curl_setopt ($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl,CURLOPT_ENCODING,'utf-8');
  curl_setopt($curl,CURLOPT_HTTPHEADER,array (
      'SOAPAction:""', 
      'Content-Type: text/xml; 
      charset=utf-8',
  ));
  
  curl_setopt ($curl, CURLOPT_POST, 1);
  curl_setopt ($curl, CURLOPT_POSTFIELDS, $parameters);
  $result = curl_exec($curl);
  </code></pre>
  
  <p>I get a wrong data sent error from the API side which means I am not sending a correct format.
  Can anyone please let me know how to do that?</p>
  
  <p>Update:
  Verbose information</p>
  
  <pre><code>* About to connect() to 10.2.250.4 port 9081 (#0)
  *   Trying 10.2.250.4...
  * connected
  * Connected to 10.2.250.4 (10.2.250.4) port 9081 (#0)
  &gt; POST /CoreWeb/ApplicationBusinessFacadeService HTTP/1.1
  Host: 10.2.250.4:9081
  Accept: */*
  Accept-Encoding: utf-8
  SOAPAction:""
  Content-Type: text/xml; 
      charset=utf-8
  Content-Length: 1087
  Expect: 100-continue
  
  &lt; HTTP/1.1 100 Continue
  &lt; Content-Length: 0
  &lt; Date: Thu, 20 Mar 2014 14:04:19 GMT
  &lt; Server: WebSphere Application Server/7.0
  &lt; HTTP/1.1 200 OK
  &lt; Date: Thu, 20 Mar 2014 14:04:19 GMT
  &lt; Server: WebSphere Application Server/7.0
  &lt; Content-Type: text/xml; charset=utf-8
  &lt; Content-Language: en-US
  &lt; Content-Length: 914
  &lt; 
  * Connection #0 to host 10.2.250.4 left intact
  </code></pre>