Mam problem ze skonfigurowaniem DHL Webservice eCASOrder
Mam dokument XML o nazwie test.xml
POST /app/ecas/eCASOrderWS.asmx HTTP/1.1 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "eCASOrderWS/DodajZlecenieWS" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <DodajZlecenieWS xmlns="eCASOrderWS"> <zlecenie> <Firma>string</Firma> <Ulica>string</Ulica> <Numer>string</Numer> <KodPocztowy>string</KodPocztowy> <Miasto>string</Miasto> <NumerSAP>string</NumerSAP> <Platnik>string</Platnik> <FormaPlatnosci>string</FormaPlatnosci> <DataPrzyjazduKuriera>string</DataPrzyjazduKuriera> <PrzesylkaGotowaOd>string</PrzesylkaGotowaOd> <ObiorMozliwyDo>string</ObiorMozliwyDo> <IloscPrzesylekDo31>int</IloscPrzesylekDo31> <IloscPrzesylekPow31>int</IloscPrzesylekPow31> <WagaNajciezszej>string</WagaNajciezszej> <ImieNazwisko>string</ImieNazwisko> <Email>string</Email> <TelefonStacjonarny>string</TelefonStacjonarny> <TelefonKomorkowy>string</TelefonKomorkowy> <DodatkoweInstrukcje>string</DodatkoweInstrukcje> <MiejsceNadania>string</MiejsceNadania> </zlecenie> </DodajZlecenieWS> </soap:Body> </soap:Envelope>
Muszę go wysłać na http://webapps.dhl.com.pl/app/ecas/eCASOrderWS.asmx, jak napisać taki skrypt w php?
Znalazłem w necie coś takiego, próbowałem pod "/https?:\/\/([^\/]*)(.*)/" podstawić adres dhl jednak nic nie działa:
<?php $url= "test.xml"; $host=$matches[1]; $request=$matches[2]; $yt =curl_init(); $header = "POST $request HTTP/1.0\r\n"; $header .= "Host: $host\r\n"; $header .= "Content-Type: text/xml\r\n"; $header .= "Content-Transfer-Encoding: text\r\n"; $header .= "Connection-Close: close\r\n\r\n"; $header .= $mxml; curl_setopt($yt, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($yt, CURLOPT_URL, $url); curl_setopt($yt, CURLOPT_CUSTOMREQUEST, $header); curl_setopt($yt, CURLOPT_RETURNTRANSFER, true); $rxml=curl_exec($yt); ?>
Prosiłbym o wskazówki co robię źle.