1 提示 Peer certificate cannot be authenticated with known CA certificates
服务器证书过期 使用
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
跳过验证
2 post参数带不过去
$param = array();
$param['grant_type'] = 'refresh_token';
$param['client_id'] = TB_API_key;
$param['client_secret'] = TB_API_secret;
$param['refresh_token'] = $shop['refresh_token'];
//$param['state']='qnrerp'; $param['view']='web';
$param['expires_in'] = 3600*24*365;
$param['re_expires_in'] = 3600*24*365;
// $result= ApiClient::getInstance()->ApiPostWithParamCallBack($this->getOAuthUrl(),$param,function($body){ // if(isset($body)){ // // } // }); $ch = curl_init();
//为.8上转param $cvt_prm = "";
foreach($param as $key=>$value){
$cvt_prm .= '&'.$key.'='.urlencode($value);
}
curl_setopt($ch, CURLOPT_URL, $this->getOAuthUrl());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $cvt_prm);
//为.8上跳过证书验证 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);