i don't think ftp has been enabled on my host. i get a "function not defined" when trying to use the ftp_connect method. is there a way around this?
It is still possible to do get the file using an external ftp command.
Here's what works from my Linux box:
I've created a file called ftpcommands that reads like this:
[tt]open <IP-address or ftp site name>
user <mylogin> <my password>
lcd <directory where the web server can write>
cd <directory where the file sits on foreign FTP server>
bin
get <file I need to get>
quit
[/tt]
[Notice the command on Linux is "ftp -n". That suppresses autologin, which allows the USER line of the ftpcommands file to work.]
If you're on Win32, the similar thing can work, with the following changes:
ftpcommands:
[tt]open <ftp server>
<mylogin>
<mypassword>
lcd <writeable local directory>
cd <directory for file>
bin
get <filename>
quit[/tt]
And the exec() statement should read:
[tt]exec ("ftp -s:<full path and name to ftpcommands>"[/tt] ______________________________________________________________________
My God! It's full of stars!
______________________________________________________________________
That's a very imaginative solution. I'm wondering if there might be a similar approach when it comes to hosts with disabled socket connections? Some free PHP hosts prevent users from "initiating" any kind of outgoing socket connection. Thanks for your reply.
He didn't specify the size of the file. fopen(), etc, won't be the best solution if the file were sufficiently large. ______________________________________________________________________
If this post was helpful,
click the link below
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.