Posted by C. (http://symcbean.blogspot.com/) on 11/02/07 16:45
On 2 Nov, 15:28, MikeofPet <mike.g...@comcast.net> wrote:
> I am trying to implement FTP in a PHP script but am unable to make the
> connection to the remote server. The connection step times out at the
> fsockopen function. I am not sure if it is relevant but PHP is
> configured with "allow_url_fopen" ON. I am able to do an FTP connect
> using an FTP client and using the same host/username/password
> parameters.
>
> Any ideas would be appreciated.
>
> Thanks
It's difficult to say what's happenning without a lot more info, but I
can't help thinking you're making life a lot more difficult than it
needs to be: allow_url_fopen option applies to the file access
wrappers - not fsockopen - but I'd be using the file wrappers method
in preference to implementing my own protocol stack (particularly with
FTP) - but even then I'd prefer to implement it using the curl
library.
When you say it works an FTP client - I assume you are using it
interactively from the command line - try executing it from within
your script (see http://www.php.net/manual/en/ref.exec.php). Note most
versions of the ftp client will happily work with input from a file
redirected to STDIN
C.
Navigation:
[Reply to this message]
|