華磊物流接口,php語言開發實例
電子商務
admin
發布時間:2025-12-30 09:14:57
瀏覽: 次
有些電商平臺需要對接物流接口,這樣可以在會員下單后自動對接物流接口,給第三方物流自動下單,會員也可以在訂單詳情中查看物流單號,進一步跟蹤物流信息。
公司最近對接一個華磊物流接口,用php語言開發,閑話不說,直接上代碼和截圖。
//配置信息:淼信荷蘭小包
$product_id = 4901; //產品id
$format = 'lbl_NL_XIN.frx'; //打印類型
$printType = 1; //打印類型
$customer_id = '18081';
$customer_userid = '14581';
$order_customerinvoicecode=$_POST['order_customerinvoicecode'];
$amount=sprintf("%.2f",$_POST['amount']);
$consignee_name=$_POST['consignee_name'];
$consignee_city=$_POST['consignee_city'];
$consignee_mobile=$_POST['consignee_mobile'];
$consignee_postcode=$_POST['consignee_postcode'];
$consignee_state=$_POST['consignee_state'];
$country=$_POST['country'];
$consignee_address=$_POST['consignee_address'];
$invoice_title=$_POST['invoice_title'];
$invoice_weight=$_POST['invoice_weight'];
$data = Array(
'buyerid' => '',
'consignee_address' => $consignee_address,
'consignee_city' => $consignee_city,
'consignee_mobile' => $consignee_mobile,
'consignee_name' => $consignee_name,
'trade_type' => 'ZYXT',
'consignee_postcode' => $consignee_postcode,
'consignee_state' => $consignee_state,
'consignee_telephone' => $consignee_mobile,
'country' => $country,
'customer_id' => $customer_id,
'customer_userid' => $customer_userid,
'orderInvoiceParam' => Array(
'0' => Array
(
'invoice_amount' => $amount,
'invoice_pcs' => 1,
'invoice_title' => $invoice_title,
'invoice_weight' => $invoice_weight,
'item_id' => '',
'item_transactionid' => '',
'sku' => $invoice_title,
'sku_code' => 'HL'.rand(100,999),
),
),
'order_customerinvoicecode' => $order_customerinvoicecode,
'product_id' => $product_id,
'weight' => $invoice_weight,
'product_imagepath' => '',
);
$this->WriteLog($this->FileName,"data:".urldecode(json_encode($data)));
$result = $this->curlRequest('http://146.56.219.238:8082/createOrderApi.htm', "param=" . json_encode($data));
$this->WriteLog($this->FileName,"result:".urldecode($result['result']));
截圖如下:

如果需要開發相關的物流接口,請聯系我們:QQ 804752009
公司最近對接一個華磊物流接口,用php語言開發,閑話不說,直接上代碼和截圖。
//配置信息:淼信荷蘭小包
$product_id = 4901; //產品id
$format = 'lbl_NL_XIN.frx'; //打印類型
$printType = 1; //打印類型
$customer_id = '18081';
$customer_userid = '14581';
$order_customerinvoicecode=$_POST['order_customerinvoicecode'];
$amount=sprintf("%.2f",$_POST['amount']);
$consignee_name=$_POST['consignee_name'];
$consignee_city=$_POST['consignee_city'];
$consignee_mobile=$_POST['consignee_mobile'];
$consignee_postcode=$_POST['consignee_postcode'];
$consignee_state=$_POST['consignee_state'];
$country=$_POST['country'];
$consignee_address=$_POST['consignee_address'];
$invoice_title=$_POST['invoice_title'];
$invoice_weight=$_POST['invoice_weight'];
$data = Array(
'buyerid' => '',
'consignee_address' => $consignee_address,
'consignee_city' => $consignee_city,
'consignee_mobile' => $consignee_mobile,
'consignee_name' => $consignee_name,
'trade_type' => 'ZYXT',
'consignee_postcode' => $consignee_postcode,
'consignee_state' => $consignee_state,
'consignee_telephone' => $consignee_mobile,
'country' => $country,
'customer_id' => $customer_id,
'customer_userid' => $customer_userid,
'orderInvoiceParam' => Array(
'0' => Array
(
'invoice_amount' => $amount,
'invoice_pcs' => 1,
'invoice_title' => $invoice_title,
'invoice_weight' => $invoice_weight,
'item_id' => '',
'item_transactionid' => '',
'sku' => $invoice_title,
'sku_code' => 'HL'.rand(100,999),
),
),
'order_customerinvoicecode' => $order_customerinvoicecode,
'product_id' => $product_id,
'weight' => $invoice_weight,
'product_imagepath' => '',
);
$this->WriteLog($this->FileName,"data:".urldecode(json_encode($data)));
$result = $this->curlRequest('http://146.56.219.238:8082/createOrderApi.htm', "param=" . json_encode($data));
$this->WriteLog($this->FileName,"result:".urldecode($result['result']));
截圖如下:

如果需要開發相關的物流接口,請聯系我們:QQ 804752009

售前咨詢專員