Hey,
I'm just starting out with php and I wrote a script that writes a webpage to a file. I'm just wondering if I have done it the most efficient way, or if there is a better way. Here's my code:
<?php
$filename = "write.txt";
$read = fopen($webpage, "r"); // $webpage is a form-variable.
$write = fopen($filename, "w");
while (!feof($webpage)) {
fwrite($write, fgets($read, 1024));
}
fclose($read);
fclose($write);
print "Done.";
?>
Also, when I run the program it gives me hundreds of Warnings (I suppose for each line of code) that say: Warning: Supplied argument is not a valid File-Handle resource in /home/sites/home/web/test.php on line 7
The code still functions, but they are midly annoying. Anyone have any comments or ideas?