Interestingly just worked out if I create a single write using a different IMG URL it works.
If I then do a single write with the problematic one, it fails...
So this fails
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$imgurl='http://images.eu-xmedia.de/thumbnails/34555861/5676051/pt=pic,lang=2,origfile=yes/image.gif';
$extension = "gif";
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_URL, $imgurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$i = curl_exec($ch);
if ( $i==false ) {
echo curl_errno($ch).' '.curl_error($ch);
}
$image_name=time().'.'.$extension;
$f = fopen('/path/to/m/' . $image_name ,'w+');
fwrite($f,$i);
fclose($f)
?>
whereas this works
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$imgurl='http://images.eu-xmedia.de/thumbnails/246380/5710261/pt=pic,lang=2,origfile=yes/image.gif';
$extension = "gif";
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_URL, $imgurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$i = curl_exec($ch);
if ( $i==false ) {
echo curl_errno($ch).' '.curl_error($ch);
}
$image_name=time().'.'.$extension;
$f = fopen('/path/to/m/' . $image_name ,'w+');
fwrite($f,$i);
fclose($f)
?>