//参数设置
$com = input('wuliu'); // 快递公司编码
$num = input('wlorder'); // 快递单号
$post_data = array();
$post_data["customer"] = '1234567890'; // 实时查询customer
$key= '123456789' ; // 客户授权Key
$post_data["param"] = "{\"com\":\"$com\",\"num\":\"$num\"}";
$url='http://poll.kuaidi100.com/poll/query.do';
$post_data["sign"] = md5($post_data["param"].$key.$post_data["customer"]);
$post_data["sign"] = strtoupper($post_data["sign"]); // 签名
$o="";
foreach ($post_data as $k=>$v)
{
$o.= "$k=".urlencode($v)."&"; //默认UTF-8编码格式
}
$post_data=substr($o,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$result = curl_exec($ch);
curl_close($ch);
$data = str_replace("\"",'"',$result );
$data = json_decode($data,true);