利用 PHP CURL zip压缩文件上传

$postData['file'] = "@".getcwd()."/../attachment/qianbao/{$customer_id}.zip";

$this->log->info("Qianbao file path:".$postData['file']);
//$postData['sign'] = bin2hex(md5($str_sign)); //'file' => '@d:usrwww	ranslatedocumentReadme.txt'
//$postData['file'] = "@d:homeoraclexpay-1.0.0attachmentqianbao{$customer_id}.zip";

$postData['sign'] = md5($str_sign);


$this->log->info("Qianbao Sign:".$postData['sign']);

$postUrl = "http://www.happygrp.com/agent/merchant/import";//生产

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $postUrl);
curl_setopt($curl, CURLOPT_USERAGENT,'Opera/9.80 (Windows NT 6.2; Win64; x64) Presto/2.12.388 Version/12.15');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
//curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$r = curl_exec($curl);
$e = curl_error($curl);
curl_close($curl);

  

原文地址:https://www.cnblogs.com/wanglijun/p/9680061.html