Concaténer des fichiers issus d'un FTP

  Information

Concatène plusieurs fichiers FTP dans un fichier local.

Auteur : Cédric Fronteau
  code source classé dans  FTP

 
 01    
 02    
 03    
 04    
 05    
 06    
 07    
 08    
 09    
 10    
 11    
 12    
 13    
 14    
 15    
 16    
 17    
 18    
 19    
 20    
 21    
 22    
 23    
 24    
 25    
 26    
 27    
 28    
 29    
 30    
 31    
 32    
 33    
 34    
 35    
 36    
 37    
                               
<?php
/*---------------------------------------------------------------*/
/*
    Titre : Concaténer des fichiers issus d'un FTP                                                                        
                                                                                                                          
    URL   : https://phpsources.net/code_s.php?id=846
    Date édition     : 14 Fév 2019                                                                                        
*/
/*---------------------------------------------------------------*/

function ftp_append($host $user $passwd $remotefiles $localfile $port=
21){ 
 /* Paramètres 
  * $host : hôte FTP 
  * $user : login 
  * $passwd : mot de passe 
  * $remotefiles : tableau de fichiers a telechager 
  * $localfile : fichier ou enregister les infos 
  * $port : port de connexion 
  */ 
  $stream ftp_connect($host$port); 
  if (!ftp_login($stream$user$passwd)) 
  return FALSE
  
  $fp fopen("$localfile"'w'); 
  if (is_resource($fp)) 
  { 
  foreach($remotefiles as $file
  ftp_fget($stream$fp$fileFTP_BINARY); 
  } 
  fclose($fp); 
  ftp_quit($stream); 
}

?>

          Fonctions du code - Doc officielle PHP

   php.net   Description Versions PHP OUTIL
   fclose Ferme un fichier PHP 4, PHP 5, PHP 7, PHP 8
   fopen Ouverture d'un fichier ou d'une URL PHP 4, PHP 5, PHP 7, PHP 8
   ftp_connect Ouvre une connexion FTP PHP 4, PHP 5, PHP 7, PHP 8
   ftp_fget Télécharge un fichier via FTP dans un fichier local PHP 4, PHP 5, PHP 7, PHP 8
   ftp_login Identification sur un serveur FTP PHP 4, PHP 5, PHP 7, PHP 8
   ftp_quit Alias de ftp_close() PHP 4, PHP 5, PHP 7, PHP 8
   is_resource Détermine si une variable est une ressource PHP 4, PHP 5, PHP 7, PHP 8
   return Retourne le controle du programme au module appelant. PHP 4, PHP 5, PHP 7, PHP 8

   Dites merci aux auteurs pour leurs travail, ça ne coûte rien et ça fait toujours plaisir wink

Présentation de PHP

PHP débutant et initié 50 Tutoriel

Présentation de MySQL