3.5.4 搜索货物 (PHP)
搜索货物范例程序
<?php
function searchShipment($url, $data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
$sandbox_url = "https://sandbox.unixus.com.my/api/EzLabel/Client/Shipments.svc/Json/GetShipmentsDetails"
$production_url = "https://api.unixus.com.my/EzLabel/Client/Shipments.svc/Json/GetShipmentsDetails"
$data = '
{
"_searchShipmentsParameter" : {
"ShipmentsCredentials" : {
"CultureType" : "1",
"Password" : "password",
"UserName" : "username"
},
"ShipmentsNo" : ["344010500000151"]
}
}
';
$response = searchShipment($sandbox_url, $data);
var_dump($response);
?>