利用 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:\usr\www\translate\document\Readme.txt'
//$postData['file'] = "@d:\home\oracle\xpay-1.0.0\attachment\qianbao\{$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);

  

posted @ 2018-09-20 12:07  王默默  阅读(1192)  评论(0编辑  收藏  举报