11/03/2003, 14:39
|
| | Fecha de Ingreso: enero-2003
Mensajes: 286
Antigüedad: 22 años Puntos: 0 | |
Ejemplo FTP No me funciona este ejemplo, se cae en la ejecucion del comando, arojando el mensaje: There is no output from this command or it failed . Si alguien sabe porque por favor me ayude.
ah¡ obviamente las variables server, user_name y user_pass no son las del ejemplo y la conexion se estable correctamente.
<?PHP
_ $FTP_SERVER _= 'myserver.tld';
_ $FTP_USER_NAME = 'myusername';
_ $FTP_USER_PASS = 'mypassword';
_ $FTP_COMMAND _ = 'ls -l';
_ // Try to connect
_ $fc = ftp_connect($FTP_SERVER);
_ if($fc) {
_ _ _ print("Connected to server $FTP_SERVER.\n");
_ _ _ // Login
_ _ _ if(! @ftp_login($fc, $FTP_USER_NAME, $FTP_USER_PASS)) {
_ _ _ _ _ print("Can't logged in as user $FTP_USER_NAME.\n");
_ _ _ _ _ exit;
_ _ _ _ } else {
_ _ _ _ _ print("Logged in as user $FTP_USER_NAME.\n");
_ _ _ };
_ _ _ // Exec command
_ _ _ print("\nOutput from executing '$FTP_COMMAND'\n\n");
_ _ _ $sR = nl2br(@ftp_exec($fc, $FTP_COMMAND));
_ _ _ if($R) {
_ _ _ _ _ print($sR);
_ _ _ _ } else {
_ _ _ _ _ print("There is no output from this command or it failed.\n");
_ _ _ };
_ _ _ // Close connection
_ _ _ ftp_quit($fc);
_ _ _ print("\nConnection closed.\n");
_ _ } else {
_ _ _ print("Can't connected to server $FTP_SERVER.\n");
_ };
?> |