$ch = curl_init ();
$times=time();
$data=['client_id'=>$this->clientId,
'start_update_time'=>1575699775,
'end_update_time'=>1575700015,
'timestamp'=>$times,
'type'=>'pdd.ddk.all.order.list.increment.get',
'page_size'=>100,
'page'=>1,
];
$params=$data;
//签名步骤一:按字典序排序参数
ksort($params);
$buff = "";
foreach ($params as $k => $v)
{
if($k != "sign" && $v !== "" && !is_array($v)){
$buff .= $k . $v ;
}
}
$string = $buff;
//签名步骤二:在string首尾加上client_secret
$string = $this->clientSecret . $string . $this->clientSecret;
//签名步骤三:MD5加密
$string = md5($string);
//签名步骤四:所有字符转为大写
$result = strtoupper($string);
$sign = $result;
$data['sign']=$sign;
$url="http://gw-api.pinduoduo.com/api/router";
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 60 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec ( $ch );
echo $result;die;
php请求接口
最新推荐文章于 2024-04-17 15:39:09 发布