华磊物流接口,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
 

在线咨询

点击这里给我发消息售前咨询专员

点击这里给我发消息售后服务专员

在线咨询

免费通话

24h咨询:0475-2793529


如您有问题,可以咨询我们的24H咨询电话!

免费通话

微信扫一扫

微信联系
返回顶部