0
Ich verwende Curl Excel-Datei von einem API-Aufruf zu erhalten heruntergeladen haben, in einem meiner api nennen es gibt eine Excel-Datei,Locken-API-Aufruf heruntergeladenen Datei
Ich mag Download zu erzwingen, die Excel-Datei, wie kann Ich mache das mit Curl?
ich versucht, wie folgt aus: -
$url = 'http://xyzwebsite.com/GetExcelParameterScheet';
$fields = array('TemplateID' => $id);
$method = 'POST';
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
Es gibt eine Antwort hier http://StackOverflow.com/Questions/22155882/PHP-Curl-Download-file – motanelu
Nein, nicht wie t Hut. Meine API-Antwort füllt keine Datei aus. Antwort nicht mit Daten enthält nur Download-Datei. aber inssted Download-Datei. @Motanelu –