PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ftp_put> <ftp_nlist
Last updated: Fri, 22 Aug 2008

view this page in

ftp_pasv

(PHP 4, PHP 5)

ftp_pasvHabilita o deshabilita el modo pasivo

Descripción

bool ftp_pasv ( resource $secuencia_ftp , bool $pasv )

ftp_pasv() habilita o deshabilita el modo pasivo. En modo pasivo, las conexiones de datos son iniciadas por el cliente, en lugar del servidor. Puede requerirse si el cliente se encuentra detrás de un firewall.

Por favor note que ftp_pasv() únicamente puede llamarse después de un inicio de sesión exitoso, de otra forma fallará.

Lista de parámetros

secuencia_ftp

El identificador de enlace de la conexión FTP.

pasv

Si es TRUE, el modo pasivo es habilitado, de lo contrario es deshabilitado.

Valores retornados

Devuelve TRUE si todo se llevó a cabo correctamente, FALSE en caso de fallo.

Ejemplos

Example #1 Ejemplo de ftp_pasv()

<?php
$archivo 
'algunarchivo.txt';
$archivo_remoto 'leame.txt';

// configurar conexión básica
$id_con ftp_connect($servidor_ftp);

// iniciar sesión con nombre de usuario y contraseña
$resultado_login ftp_login($id_con$ftp_nombre_usuario$ftp_contrasenya);

// habilitar modo pasivo
ftp_pasv($id_contrue);

// cargar un archivo
if (ftp_put($id_con$archivo_remoto$archivoFTP_ASCII)) {
 echo 
"se ha cargado $archivo con éxito\n";
} else {
 echo 
"Hubo un problema al cargar $archivo\n";
}

// cerrar la conexión
ftp_close($id_con);
?>



add a note add a note User Contributed Notes
ftp_pasv
ybourbeau at edison dot ca
09-Apr-2002 12:28
Directly from bsd FTP manual pages:

The PASV command requests that the remote server open a port for the data connection and return the address of that port.  The remote server listens on that port and the client connects to it.

                 When using the more traditional PORT command, the client listens on a port and sends that address to the remote server, who connects back to it.  Passive mode is useful when using ftp through a gateway router or host that controls the directionality of traffic.  (Note that though ftp servers are required to support the PASV command by RFC 1123, some do not.)
04-Apr-2002 02:19
PASV: For ftp users behind firewall, the server LISTEN for a connection.

Non-PASV: The client LISTEN for a connection from server.

ftp_put> <ftp_nlist
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites