Code 1:
$img = ‘/my/folder/flower.gif’
file_put_contents($img, file_get_contents($url));
Code 2:
$fp = fopen(‘/my/folder/flower.gif’, ‘wb’);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
Code 1:
$img = ‘/my/folder/flower.gif’
file_put_contents($img, file_get_contents($url));
Code 2:
$fp = fopen(‘/my/folder/flower.gif’, ‘wb’);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
Code 3:
file_put_contents(‘/my/folder/flower.jpg’, $content);
Code 4:
{ //Download images from remote server
$in= fopen($inPath, “rb”);
$out= fopen($outPath, “wb”);
while ($chunk = fread($in,8192))
{
fwrite($out, $chunk, 8192);
}
fclose($in);
fclose($out);
}
save_image(‘http://www.someimagesite.com/img.jpg’,’image.jpg’);