$post_data = array (
'isPublic' => 'true',
'fileElementId' => 'imgfile',
'imgfile' => "@".$fullPathFile,
);
$oCurl = curl_init();
// 不同PHP版本默认的参数不同,强制设置下
curl_setopt($oCurl, CURLOPT_SAFE_UPLOAD, false);
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($oCurl, CURLOPT_POST, true);
curl_setopt($oCurl, CURLOPT_POSTFIELDS, $params);
curl_setopt($oCurl, CURLOPT_VERBOSE, 1);
curl_setopt($oCurl, CURLOPT_HEADER, false);
curl_setopt($oCurl, CURLINFO_HEADER_OUT, false);
curl_setopt($oCurl, CURLOPT_TIMEOUT, 100);
|