//office转pdf // $pdfUrl = ''; // if($datas['status'] == PROJECT_STATUS_COMPLETE){ // $host = "https://ali.duhuitech.com"; // $path = "/v1/convert"; // $method = "GET"; // $appcode = "ea40944bdd9342e3aa9d3cec94b70fd5"; // $headers = array(); // array_push($headers, "Authorization:APPCODE " . $appcode); // $querys = "url=".get_public_url().'/xls/'.$fileName. '.Xlsx&type=xlsx'; // $bodys = ""; // $url = $host . $path . "?" . $querys; // // $curl = curl_init(); // curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); // curl_setopt($curl, CURLOPT_URL, $url); // curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // curl_setopt($curl, CURLOPT_FAILONERROR, false); // curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // curl_setopt($curl, CURLOPT_HEADER, true); // if (1 == strpos("$".$host, "https://")) // { // curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // } // $output = (curl_exec($curl)); // // if(!curl_errno($curl)) // { // $response = curl_getinfo($curl, CURLINFO_HTTP_CODE); // if($response === 200){ // // 获得响应结果里的:头大小 // $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); // $headerTotal = strlen($output); // $bodySize = $headerTotal - $headerSize; // // 根据头大小去获取头信息内容 // $header = substr($output, 0, $headerSize); // $comma_separated = explode("\r\n", $header); // $arr = array(); // foreach ($comma_separated as $value) { // if (strpos($value, ':') !== false) { // $a = explode(":", $value); // $key = $a[0]; // $v = $a[1]; // $arr[$key] = $v; // } else { // array_push($arr, $value); // } // } // // $body =json_decode(substr($output, $headerSize, $bodySize),true) ; // if($body['code']=== 10000){ // $token= $body['result']['token']; // $res = curl_get('https://api.duhuitech.com/q?token='.$token); // $res = json_decode($res, true); // if($res['code'] == 10000 &&$res['result']['status']!='Failed'){ // $pdfUrl = $res['result']['pdfurl']; // } // } // } // } // curl_close($curl); // }
版权声明:本文为sxxzwzf原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。