3.2.4 刪除貨物 (PHP)

刪除貨物範例程式
<?php function processShipments($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; } function ShipmentV1ApiDate($myDate) { $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $myDate); $requiredJsonFormat = sprintf('/Date(%s%s)/', $dateTime->format('U') * 1000, $dateTime->format('O')); return $requiredJsonFormat; } $sandbox_url = "https://sandbox.unixus.com.my/api/EzLabel/Client/Shipments.svc/Json/ProcessShipments"; $production_url = "https://api.unixus.com.my/EzLabel/Client/Shipments.svc/Json/ProcessShipments"; $data = ' { "_shipmentsParameter" : { "ActionType" : "2", "ShipmentsCredentials" : { "UserName" : "username", "Password" : "password", "CultureType" : 0 }, "CustomerCode" : "300001", "ProfitCentreCode" : "", "HawbNo" : "344010500000151", "ShipmentDate": "/Date(1506330946000+0800)/", "Submitted_Date": "/Date(1506330946000+0800)/" } } '; $response = processShipments($sandbox_url, $data); var_dump($response); ?>
Copyright © 2018 Unixus Solutions Sdn. Bhd. All rights reserved.