Files
archived-doc-pt-br/reference/ftp/examples.xml
Leonardo Lara Rodrigues 70f1ea52c1 Updates to outdated pages in reference/ (filter,fpm,ftp,funchand) (#382)
* Updates to abandoned/outdated/missing pages in reference/math/

* Correction from `en` version

* Revision ready

* Updates to outdated pages in reference/dom

* Updates to reference/dbase/ pages

* Corrections to math functions pages

* Updates to abandoned/outdated pages in reference/dbase

* Correction to function name

* Updates to outdated pages in reference (filter,fpm,ftp,funchand)

---------

Co-authored-by: LEONARDO LARA RODRIGUES <leonardolara@github.com>
2023-12-04 13:21:53 -03:00

71 lines
1.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d1c34c9b7a30cfc3a59641122c707a2812cfed7 Maintainer: leonardolara Status: ready --><!-- CREDITS: felipe,leonardolara -->
<chapter xml:id="ftp.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="ftp.examples-basic">
<title>Uso básico</title>
<para>
<example>
<title>Exemplo da extensão FTP</title>
<programlisting role="php">
<![CDATA[
<?php
// configura uma conexão básica
$ftp = ftp_connect($ftp_server);
// faz login com usuário e senha
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// verifica conexão
if ((!$ftp) || (!$login_result)) {
echo "Conexão FTP falhou!";
echo "Tentativa de conexão a $ftp_server para o usuário $ftp_user_name";
exit;
} else {
echo "Conectado a $ftp_server, para o usuário $ftp_user_name";
}
// envia o arquivo
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);
// verifica estado do envio
if (!$upload) {
echo "Envio por FTP falhou!";
} else {
echo "Enviado $source_file a $ftp_server como $destination_file";
}
// fecha a conexão FTP
ftp_close($ftp);
?>
]]>
</programlisting>
</example>
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=xml
vi: ts=1 sw=1
-->