Path in the Gestor bibliotecas/ftp.php
A thin layer over PHP's ftp extension, with one connection per request kept in $_GESTOR['ftp-conexao']. No core module uses it; project deploys are done by the CLI (SSH or API), not by this library.
gestor_incluir_biblioteca('ftp');
if (ftp_conectar(['host' => 'ftp.example.com', 'usuario' => $u, 'senha' => $s, 'secure' => true])) {
ftp_colocar_arquivo(['local' => '/tmp/report.csv', 'remoto' => 'reports/report.csv']);
ftp_pegar_arquivo(['remoto' => 'inbox/list.txt', 'local' => '/tmp/list.txt']);
ftp_fechar_conexao();
} else {
error_log($_GESTOR['ftp-erro']);
}-
ftp_conectar()usesftp_ssl_connect()whensecure === trueand the function exists; otherwise, unencrypted FTP, silently. It turns on passive mode unless$_GESTOR['ftp-conexao-nao-passiva']is set. On failure, it stores the message in$_GESTOR['ftp-erro']. -
ftp_colocar_arquivo()andftp_pegar_arquivo()useFTP_BINARYby default (modoFTPchanges it) and returntrue/false; withoutlocalorremoto, they returnnull. -
Without the
ftpextension installed, the first call ends in a fatal error.
Functions
Generated from gestor/bibliotecas/ftp.php · 4 functions
ftp_conectar
view source · line 41 ↗ftp_conectar(array|false $params = false): boolEstabelece conexão com servidor FTP.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
ftp_fechar_conexao
view source · line 90 ↗ftp_fechar_conexao(array|false $params = false): bool|voidFecha a conexão FTP ativa.
Parameters
$paramsarray|false- Parâmetros da função (não utilizado atualmente).
Returns
ftp_colocar_arquivo
view source · line 125 ↗ftp_colocar_arquivo(array|false $params = false): bool|voidEnvia um arquivo para o servidor FTP.
Parameters
$paramsarray|false- Parâmetros da função.
Returns
ftp_pegar_arquivo
view source · line 169 ↗ftp_pegar_arquivo(array|false $params = false): bool|voidBaixa um arquivo do servidor FTP.
Parameters
$paramsarray|false- Parâmetros da função.
Returns