CLI (git Bash를 통해)에서 매우 잘 작동하는 cURL 명령이 있습니다. 아래를 참조구문을 cURL에서 PHP cURL로 변환
curl -D- -k -o tvdata.xls -u adminid:adminpw -X GET -H "Content-Type: application/vnd.ms-excel" https://localhost/jira/sr/jira.issueviews:searchrequest-excel-current-fields/temp/SearchRequest.xls?jqlQuery=project+%3D+LPCCU+AND+type+%3D+Incident
이 명령 수출 아주 잘 내 JIRA에서 엑셀 파일 (XLS)의 모든 문제를 해결합니다. 이제이 명령을 PHP 컬로 변환하고 싶습니다. 이 코드 아래 시도 :
$url = 'https://build.bnum.laposte.fr/jira/sr/jira.issueviews:searchrequest-excel-current-fields/temp/SearchRequest.xls?jqlQuery=project+%3D+LPCCU+AND+type+%3D+Incident';
$username ='adminid';
$password ='adminpw';
$file = fopen('tvdata.xls', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/vnd.ms-excel"));
curl_setopt($ch, CURLOPT_NOPROGRESS, FALSE);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 15000);
curl_setopt($ch, CURLOPT_FILE, $file);
curl_exec($ch);
curl_close($ch);
fclose($file);
하지만 난이 PHP 코드를 실행할 때, 그는 빈는 파일을 엑셀,하지만 오류가 발생하는하지 않고 만들 수 있습니다. 누군가이 문제를 알아낼 수 있다면? 사전에
덕분에
Achillix
대답에 대해 CURLOPT_RETURNTRANSFER를 1 – diavolic
@diavolic THX로 설정하십시오. 응답 내용과 도움이 필요하면 – achillix