Forum Moderators: coopster
[php]
<?php
// For PHP 5 and up
$handle = fopen("http://www.example.com/", "a+");
$contents = stream_get_contents($handle);
$filename = 'test.txt';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// Write $somecontent to our opened file.
if (fwrite($handle, $contents) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
[/php]
i get this error:
Warning: fopen(http://www.example.com/) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections. in /home/example/public_html/proxy/index.php on line 3
Fatal error: Call to undefined function: stream_get_contents() in /home/example/public_html/proxy/index.php on line 4
thanks in advance!