Upload file(s) using socket/fopen

From: Date: Thu, 25 Oct 2001 19:27:11 +0000
Subject: Upload file(s) using socket/fopen
Groups: php.general 
Request: Send a blank email to php-general+get-72332@lists.php.net to get a copy of this message
Hello list, Simple Enough Objective: store file remotely (wu-ftp); MinorSnag: PHP's ftp-functions unavailable at localhost; BelowWorkaround: works fine for deleting remote file; MajorSnag: how to STORE a file remotely using socket? <?php $ftp=fsockopen("ftp.server.com", 21, $errno, $errstr, 60); if (!$ftp) { echo "Connection failed: $errstr ($errno)"; exit; } else { socket_set_blocking($ftp, true); echo fgets($ftp,255); fputs($ftp,"USER ftp_username\r\n"); echo fgets($ftp,255); fputs($ftp,"PASS ftp_passw\r\n"); echo fgets($ftp,255); fputs($ftp,"DELE /home/httpd/html/test.htm\r\n"); echo fgets($ftp,255); fputs($ftp,"QUIT\r\n"); echo fgets($ftp,255); fclose($ftp); } ?> BTW: I also messed with fopen("ftp://user:pass@...") but failed miserably (although it seemed possible before my mind wandered off). ANY HELP IS APPRECIATED (using socket, fopen, ...) -- SpeedFreak@chello.be

« previous php.general (#72332) next »