require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$url = "/expressebill/add?appkey=$appkey";
$appsecret = 'ssssssssssss';
$post = ['type'=>'', 'senderprovince'=>'', 'sendercity'=>'', 'sendertown'=>'', 'senderaddress'=>'', 'sendername'=>'', 'sendermobile'=>'', 'sendertel'=>'', 'sendercompany'=>'', 'senderzipcode'=>'', 'addresseeprovince'=>'', 'addresseecity'=>'', 'addresseetown'=>'', 'addresseeaddress'=>'', 'addresseename'=>'', 'addresseemobile'=>'', 'addresseetel'=>'', 'addresseecompany'=>'', 'addresseezipcode'=>'', 'product'=>'', 'ordertype'=>'', 'orderremark'=>'', 'accountid'=>'', 'password'=>'', 'weight'=>'', 'dimension'=>'', 'freighttype'=>'', 'producttype'=>'', 'freight'=>'', 'isnotice'=>'', 'starttime'=>'', 'endtime'=>'', 'collectionamount'=>'', 'insuredamount'=>''];//不包含appkey
$post['sign'] = makeSign($post, $appsecret);
$result = curlOpen($url, ['ssl'=>true, 'post'=>$post]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['orderno'].' '.$result['number'].' '.$result['printhtml'];
foreach($result['ebill'] as $key=>$val)
{
echo $val['packageplace'].' '.$val['code1'].' '.$val['code2'].' '.$val['code3'].' '.$val['qrcode'].' '.$val['startbranchcode'];
}
/**
* 生成签名
*
*/
function makeSign($queryarr, $appsecret)
{
ksort($queryarr, SORT_STRING);
$str = implode($queryarr);
$str .= $appsecret;
//exit($str);
$str = md5($str);
return $str;
}