mirror of
https://github.com/php/doc-fr.git
synced 2026-03-23 22:52:18 +01:00
68 lines
1.8 KiB
XML
68 lines
1.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 4d1c34c9b7a30cfc3a59641122c707a2812cfed7 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<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>Utilisation simple</title>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec FTP</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Mise en place d'une connexion basique
|
|
$ftp = ftp_connect($ftp_server);
|
|
|
|
// Identification avec un nom d'utilisateur et un mot de passe
|
|
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
|
|
|
|
// Vérification de la connexion
|
|
if ((!$ftp) || (!$login_result)) {
|
|
echo "La connexion FTP a échoué !";
|
|
echo "Tentative de connexion au serveur $ftp_server pour l'utilisateur $ftp_user_name";
|
|
exit;
|
|
} else {
|
|
echo "Connexion au serveur $ftp_server, pour l'utilisateur $ftp_user_name";
|
|
}
|
|
|
|
// Chargement d'un fichier
|
|
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);
|
|
|
|
// Vérification du statut du chargement
|
|
if (!$upload) {
|
|
echo "Le chargement FTP a échoué!";
|
|
} else {
|
|
echo "Chargement de $source_file vers $ftp_server en tant que $destination_file";
|
|
}
|
|
|
|
// Fermeture de la connexion 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
|
|
-->
|