public function fastBird($code , $no)
{
$requestData = "{" .
"'CustomerName': ''," .
"'OrderCode': ''," .
"'ShipperCode': '{$code}'," .
"'LogisticCode': '{$no}'," .
"}";
$data = array(
'EBusinessID' => '用户ID',
'RequestType' => '1002',
'RequestData' => urlencode($requestData),
'DataType' => '2',
);
$data['DataSign'] = $this->fastEncrypt($requestData, 'appkey');
$result = $this->fastSendPost('https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx', $data);
return json_decode($result);
}
public function fastSendPost($url, $data)
{
$postdata = http_build_query($data);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
public function fastEncrypt($data,$ApiKey)
{
return urlencode(base64_encode(md5($data . $ApiKey)));
}
|