Problems with fopen FTP upload to another server

From: Date: Tue, 09 May 2000 22:36:05 +0000
Subject: Problems with fopen FTP upload to another server
Groups: php.general 
Request: Send a blank email to php-general+get-9@lists.php.net to get a copy of this message
The Project: I am working on a project that requires that I move a file from the local server to an arbitrary remote server (given a username and password) via FTP using PHP. The project is a content management system of sorts, and I will need to be able to allow users to press a "Publish" button and it will FTP a local HTML file to their remote webserver of choice. The Problem: The documentation pointed me to using fopen(). But the following command fails with an "Transport endpoint not connected" error when I try to use it: $fp = fopen("ftp://user:pass@hostname.com/file.txt","w"); When followed by a fputs(), that command should open a passive FTP session with hostname.com and allow me to write to file.txt (which may or may not exist on the remote server). But it fails every time. I thought about using fsockopen() and writing my own FTP connection functions, but it is way too difficult (FTP uses two ports 21/20 and such), and would be basically reinventing the wheel. Due to project constraints and such, assume that I can not use the PHP4 ftp_ functions, and that I cant recompile PHP with the ftp_ functions. Also, I must use FTP to transfer the files, not any other protocol. And assume that I can not use any third party stuff, such as ncFTP or Perl. It all has to be PHP3. I have tried connecting to many servers, all of which support boh active and passive FTP sessions without a problem. So the problem is defninitely in the PHP, not the servers. Any help would be greatly appreciated. Please cc: my email address with your replies, as I am not subscribed to this mailing list. Thank you in advance, John John P. Mulligan <john@thinkhole.com>

« previous php.general (#9) next »