downloading a file from URL to my own website
Posted: Fri May 27, 2005 6:11 am
Hello!
I was wondering if somebody could help me with a code.
I want to download a file from a webpage, for example from http://www.blabla.com/my file.txt
and place it on my webhotel for example /home/b4344/my_file.txt
I tried this code, but it doesn´t work:
please help!
Regards,
Mark
I was wondering if somebody could help me with a code.
I want to download a file from a webpage, for example from http://www.blabla.com/my file.txt
and place it on my webhotel for example /home/b4344/my_file.txt
I tried this code, but it doesn´t work:
Code: Select all
$file1 = fopen("http://www.blabla.com/my file.txt", "r");
$file2 = fopen("/home/b4344/my_file.txt", "w";
if (!copy($file1, $file2))
{
echo "failed to copy $file1...<br />\n";
}Regards,
Mark