|
@@ -345,9 +345,11 @@ function pdfCurl($file_name)
|
|
|
curl_setopt($ch, CURLOPT_URL, 'http://101.132.128.55:9999/v1/pdf/upload');
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['file@'=>$file_name]));
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, ['file'=>$file_name]);
|
|
|
$headers = array();
|
|
|
+
|
|
|
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
|
|
+ $headers[] = 'Content-Type: multipart/form-data';
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
|
|
$result = curl_exec($ch);
|
|
|
if (curl_errno($ch)) {
|
|
@@ -357,7 +359,33 @@ function pdfCurl($file_name)
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+function curlPost($url, $post_data = array(), $timeout = 5, $header = "", $data_type = "") {
|
|
|
+ $header = empty($header) ? '' : $header;
|
|
|
+ //支持json数据数据提交
|
|
|
+ if($data_type == 'json'){
|
|
|
+ $post_string = json_encode($post_data);
|
|
|
+ }
|
|
|
+ else if(is_array($post_data)){
|
|
|
+ $post_string = http_build_query($post_data, '', '&');
|
|
|
+ }else {
|
|
|
+ $post_string = $post_data;
|
|
|
+ }
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_POST, true);
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // https请求 不验证证书和hosts
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
|
|
+ curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
|
|
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array($header)); //模拟的header头
|
|
|
+ $info = curl_getinfo($ch);
|
|
|
+ $result = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
|
|
|
+ return $result;
|
|
|
+}
|
|
|
|
|
|
function getVideoTime($ali_id)
|
|
|
{
|