title: How to HTTP POST a XML File using PHP without cURL?
body: <p>I have a XML created from a Table In MySql, I need to make a HTTP Post to insert the XML into a Web Service. The Web Service just accepts SOAP, HTTP POST and HTTP GET methods. I tried to make the HTTP POST request in different ways with no luck at all. I never worked with SOAP before. How can I make the HTTP POST or SOAP Request? </p>
  
  <p>post_xml.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?ADF version="1.0"?&gt;
  &lt;adf&gt;
  &lt;prospect&gt;&lt;id sequence="1" source="xxxs"&gt;37&lt;/id&gt;
  &lt;requestdate&gt;2013-07-10 06:10:42&lt;/requestdate&gt;
  &lt;vehicle interest="buy" status="new"&gt;
  &lt;year&gt;2013&lt;/year&gt;
  &lt;make&gt;12&lt;/make&gt;
  &lt;model&gt;21&lt;/model&gt;
  &lt;trim&gt;Sport&lt;/trim&gt;
  &lt;/vehicle&gt;
  &lt;customer&gt;
  &lt;contact&gt;
  &lt;name part="first"&gt;Jay&lt;/name&gt;
  &lt;name part="last"&gt;11z&lt;/name&gt;
  &lt;email&gt;test@gmail.com&lt;/email&gt;
  &lt;phone time="morning" type="voice" preferredcontact="1"&gt;99999999&lt;/phone&gt;
  &lt;address&gt;
  &lt;street line="1"&gt;1130 E Test&lt;/street&gt;
  &lt;city&gt;sa&lt;/city&gt;
  &lt;regioncode&gt;Z&lt;/regioncode&gt;
  &lt;postalcode&gt;79924&lt;/postalcode&gt;
  &lt;country&gt;USA&lt;/country&gt;
  &lt;/address&gt;
  &lt;/contact&gt;
  &lt;/prospect&gt;
  &lt;/adf&gt;
  </code></pre>
  
  <p>client1.php (HTTP POST CODE)</p>
  
  <pre><code>$xml = file_get_contents('post_xml.xml');
  $url = 'http://stg.sa.com/post.asmx/';
  
  $post_data = array ("XML" =&gt; $xml);
  $stream_options = array(
      $url =&gt; array(
          'method'  =&gt; 'POST',
          'header'  =&gt; 'Content-type: application/x-www-form-urlencoded' . "\r\n",
          'content' =&gt; http_build_query($post_data)
      )
  );
  $context = stream_context_create($stream_options);    
  $response = file_get_contents($url, null, $context);
  </code></pre>
  
  <p>HTTP POST specs of the Web Service:</p>
  
  <p>The following is a sample HTTP POST request and response.</p>
  
  <pre><code>POST /st.asmx/Post HTTP/1.1
  Host: stg.sa.com
  Content-Type: application/x-www-form-urlencoded
  Content-Length: length
  XML= string
  
  HTTP/1.1 200 OK
  Content-Type: text/xml; charset=utf-8
  Content-Length: length
  
  &lt;?xml version="1.0"?&gt;
  xml
  </code></pre>