I need to send data using json_encode
. I just get the reference below:
$key = 'my_key';
$url = 'url';
$data = array (
'username' => 'user',
'api_key' => 'key',
'orderid' => 'ORDERID-0001'
'shipper_name' => 'SENDER',
'shipper_contact' => 'SENDER',
'shipper_phone' => 'sender_phone',
'shipper_addr' => 'sender address',
'origin_code' => 'CITYCODE',
'receiver_name' => 'RECEIVER',
'receiver_phone' => 'receiver_phone',
'receiver_addr' => 'receiver address',
'receiver_zip' => 'receiver zip',
'destination_code' => 'DESTCODE',
'receiver_area' => 'SDA001',
'qty' => '1',
'weight' => '1',
'goodsdesc' => 'TESTING!!',
'servicetype' => '1',
'insurance' => '50000',
'orderdate' => '2019–2-10 22:02:00',
'item_name' => 'hat',
'cod' => '200000',
'sendstarttime' => '2017–2-10 08:00:00',
'sendendtime' => '2017–2-10 22:00:00',
'expresstype' => '1',
'goodsvalue' => '1000',
);
$data_json = json_encode(array('detail'=>array($data)));
$data_request = array (
'data_param'=>$data_json,
'data_sign'=> base64_encode(md5($data_json.$key))
);
I was send the data above using Postman but it returned "Parameters can not null". Then I try using curl but the response HTTP 500.
Can someone here tell me the best practice to get best response?
By the way this is sample response if the code above is success:
{
"success":true,
"desc":"request success",
"detail":
[
{
"orderid" : "ORDERID-0001",
"status" : "Error",
"reason" : "username or api key wrong!",
}
{
"orderid" : "ORDERID-0002",
"awb_no" : "AWBJNT-001"
"status" : "Success",
}
]
}