Jak HTTP POST pliku XML przy użyciu PHP bez cURL? [duplikować]

To pytanie ma już tutaj odpowiedź:

Jak opublikować dane w PHP za pomocą file_get_contents? 3 odpowiedzi

Mam plik XML utworzony z tabeli w MySql, muszę utworzyć post HTTP, aby wstawić XML do usługi sieci Web. Usługa sieci Web akceptuje metody SOAP, HTTP POST i HTTP GET. Próbowałem wykonać żądanie HTTP POST na różne sposoby, bez żadnego szczęścia. Nigdy wcześniej nie pracowałem z SOAP. Jak mogę wykonać żądanie HTTP POST lub SOAP?

post_xml.xml:

<?xml version="1.0" encoding="utf-8"?>
<?ADF version="1.0"?>
<adf>
<prospect><id sequence="1" source="xxxs">37</id>
<requestdate>2013-07-10 06:10:42</requestdate>
<vehicle interest="buy" status="new">
<year>2013</year>
<make>12</make>
<model>21</model>
<trim>Sport</trim>
</vehicle>
<customer>
<contact>
<name part="first">Jay</name>
<name part="last">11z</name>
<email>[email protected]</email>
<phone time="morning" type="voice" preferredcontact="1">99999999</phone>
<address>
<street line="1">1130 E Test</street>
<city>sa</city>
<regioncode>Z</regioncode>
<postalcode>79924</postalcode>
<country>USA</country>
</address>
</contact>
</prospect>
</adf>

client1.php (HTTP POST CODE)

$xml = file_get_contents('post_xml.xml');
$url = 'http://stg.sa.com/post.asmx/';

$post_data = array ("XML" => $xml);
$stream_options = array(
    $url => array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded' . "\r\n",
        'content' => http_build_query($post_data)
    )
);
$context = stream_context_create($stream_options);    
$response = file_get_contents($url, null, $context);

Specyfikacje HTTP POST usługi sieci Web:

Poniżej przedstawiono przykładowe żądanie i odpowiedź HTTP POST.

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

<?xml version="1.0"?>
xml

questionAnswers(1)

yourAnswerToTheQuestion