przepraszam... byłem święcie przekonany że wrzuciłem kod...
<?php
$sql_host = '';
$sql_user = '';
$sql_password = '';
$sql_baza = '';
or
die("Could not connect");
or
die("Could not select database");
function curl($adres) {
$curl = curl_init($adres);
curl_setopt($curl, CURLOPT_FAILONERROR, 1);
curl_setopt($curl, CURLOPT_URL, $adres);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 40);
$response = curl_exec($curl);
// Get the response information
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($code AND $code < 200 OR $code > 299) {
$error = $response;
}
elseif($response === false) {
$error = curl_error($curl);
}
// Close the connection
curl_close($curl);
throw
new Exception
(sprintf('[%s] %s', $code, $error)); }
return $response;
}
$query = "SELECT * FROM avtoclassika WHERE image IS NOT NULL";
$row["image"];
$adres = $row["image"];
$img = curl($adres);
file_put_contents('/homepages/test/'.$row["id"].'.jpg', $img);
}
}
?>