|
Posted by J.O. Aho on 12/09/06 12:53
Wolfgang wrote:
> I still do something wrong, when I execute your Code nothing happen.
> There is no need for me to show the picture (it does not appear either),
> I would be happy if I had the picture on my FTP after I called my Site.
see http://www.php.net/manual/en/function.fwrite.php
<?php
$filename = 'test.gif';
// The image isn't allowed to be larger than memory_limit in php.ini
// The download time aren't allowed to be longer than timeout for server
// where the script is run on.
$somecontent=file_get_contents("http://www.google.de/intl/de_de/images/logo.gif");
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
//Aho
Navigation:
[Reply to this message]
|