I have this URL
'http://2.bp.blogspot.com/-LBbpkomI7JQ/VnLmeFZANgI/AAAAAAAAWhc/MsdZjtxN0HQ/s0-Ic42/RCO001.jpg '
I tried to do some search and did this
$file = fopen("C:\Users\Alex\Desktop\script.txt", "r");
$links = array();
while (!feof($file)) {
$links[] = fgets($file);
}
fclose($file);
foreach($links as $num => $link)
{
echo "'".$link."'";
save_image("'".$link."'","'".$num."'".".jpg");
}
var_dump($links);
function save_image($inPath,$outPath)
{ //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);
}
All urls are in my script.txt file so I am storing them in an array then calling each url one by one but it says
failed to open stream: Invalid argument
Anything missing or wrong?