0
Ich möchte ein Bild von einem Remote-Server nur herunterladen, wenn es nicht älter als zwei Tage ist.Curl herunterladen Bild nur wenn nicht älter als 2 Tage
Ist der Code, den ich ausführe, richtig? Ich möchte die last_modified
Daten vor dem Download wissen.
$ch = curl_init($file_source); // the file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FILE, $wh);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILETIME, true);
curl_exec($ch);
$headers = curl_getinfo($ch);
$last_modified = $headers['filetime'];
if ($last_modified != -1) { // unknown
echo date("Y-m-d", $last_modified); //etc
}
curl_close($ch);
fclose($wh);