即時通訊使用瀏覽器下載對話框時,試圖從網址下載文件, 但當我使用此代碼時,服務器上的新文件保持空白。 URL的PHP CURL下載文件
$ch = curl_init();
$source = "https://myapps.gia.edu/ReportCheckPortal/downloadReport.do?reportNo=$row['certNo']&weight=$row['carat']";
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
$destination = "./files/certs/$row['certNo'].pdf";
$file = fopen($destination, "w+");
fputs($file, $data);
fclose($file);
例如:https://myapps.gia.edu/ReportCheckPortal/downloadReport.do?reportNo=1152872617&weight=1.35
您需要包裝在'{}'例如數組訪問' 「文本{$陣列[ '鑰匙']}」'。 –