1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
$xmlRequest = '
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trac="http://scxgxtt.phx-dc.dhl.com/glDHLExpressTrack/providers/services/trackShipment" xmlns:dhl="http://www.dhl.com">
<soapenv:Header>
<wsse:Security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:id="UsernameToken-5" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>xxxxxxxxx</wsse:Username>
<wsse:Password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxxxxxxxx</wsse:Password>
<wsse:Nonce encodingtype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">eUYebYfsjztETJ4Urt8AJw==</wsse:Nonce>
<wsu:Created>2010-11-24T00:17:20Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<trac:trackShipmentRequest>
<trackingRequest>
<dhl:TrackingRequest>
<Request>
<ServiceHeader>
<MessageTime>2010-11-24T00:17:20Z</MessageTime>
<MessageReference>e71672807e9f1a2f9318e126645de100</MessageReference>
</ServiceHeader>
</Request>
<!--Optional:-->
<AWBNumber>
<!--1 or more repetitions:-->
<ArrayOfAWBNumberItem>7895083910</ArrayOfAWBNumberItem>
</AWBNumber>
<!--Optional:-->
<LevelOfDetails>ALL_CHECK_POINTS</LevelOfDetails>
<!--Optional:-->
<PiecesEnabled>S</PiecesEnabled>
<!--Optional:-->
</dhl:TrackingRequest>
</trackingRequest>
</trac:trackShipmentRequest>
</soapenv:Body>
</soapenv:Envelope>';
$url = "https://wsbexpress.dhl.com:443/sndpt/glDHLExpressTrack?WSDL";
$soapAction = "glDHLExpressTrack_providers_services_trackShipment_Binder_trackShipmentRequest";
$header = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"Content-length: " . strlen($xmlRequest),
);
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, $url);
//curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
//curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS,$xmlRequest);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($soap_do);
if (!$response)
{
$err = 'Curl error: ' . curl_error($soap_do);
echo $err;
}
else {
var_dump(htmlentities($response));
echo 'plop';
}
curl_close($soap_do); |
Partager