Hi !
I have a pb with the readfile function, when the file is stored on a remote server.
Actually I have the following script :
<?php
$u = "username" ;
$p = "password" ;
$h = "123.123.123.123" ;
$c = "/dir/subdir/file.txt" ;
set_time_limit(0);
readfile("ftp://$u:$p@$h$c") ;
?>
This code works... or not !!
And I'm not able to understand why !!!
When I set the variables to use my own FTP server, it doesnt work.
Whereas it works fine when I use any other FTP, like the one where my website is hosted...
I have checked that this file access rights are the same on my FTP server than on the other FTP server I've called for test purpose. So this is not the reason why it doesnt work.
The error I get is :
"Warning: readfile("ftp://...@.123.123.123/dir/subdir/file.txt") - No such file or directory in /www/ftp.php on line 8"
Far much weird :
when I directly enter the url "ftp://username: [email]password@123.123.123.123/dir/subdir/file.txt[/email]" in any web browser (IE, Opera, Firefox...), it works fine : I get the file !!!
So, why the same URL works when directly entered in web browser, and not when as parameter for readfile() ?!!!
FYI the file size is very small... some kB...
Any idea ? 🙁((