note 40954 added to function.ftp-get

From: Date: Wed, 24 Mar 2004 17:05:58 +0000
Subject: note 40954 added to function.ftp-get
Groups: php.notes 
Request: Send a blank email to php-notes+get-67111@lists.php.net to get a copy of this message
A little more trouble shooting in this version. (we used this to download a linux patch for our game server preventing manual down/uploads) <?php // define some variables $local_file = 'cod-lnxded-1.3.large.tar.bz2'; $server_file = 'pub/3dgamers4/games/callofduty/cod-lnxded-1.3.large.tar.bz2'; $ftp_server = "3dgamers.in-span.net"; $ftp_user_name = "anonymous"; $ftp_user_pass = "guest@all.com"; // set up basic connection if ($conn_id = ftp_connect($ftp_server)) { echo "Connected to ".$ftp_server.""; }else{ echo "Can't connect to ".$ftp_server.""; exit(); } // login with username and password if ($login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass)) { echo "Logged on to ".$ftp_server."<br>User: ".$ftp_user_name."<br>Pass: ".$ftp_user_pass.""; }else{ echo "Can't logon as User: ".$ftp_user_name."<br>Pass: ".$ftp_user_pass.""; exit(); } // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo "Successfully written to $local_file\n"; } else { echo "There was a problem\n"; exit(); } // close the connection if ($conn_id) { ftp_close($conn_id); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.ftp-get.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40954 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40954&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40954&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67111) next »