$uri = ‘https://www.xxx.com/api/xxxxx’;
$ch = curl_init();
//加@符号curl就会把它当成是文件上传处理
$tmpName = $_FILES['file']['tmp_name'];
$data = array('excel'=>'@'.$tmpName);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//接口是https 需要设置此项加密
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);//接口是https 需要设置此项加密
curl_setopt($ch,CURLOPT_URL,$uri);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$result = curl_exec($ch);
$result2 = json_decode($result, true);
$err = curl_error($ch);
curl_close($ch);