We have 40 guests online
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Exploring the FTP functions
User Rating: / 0
PoorBest 
A simple script that demonstrates how the FTP functions can be used
  1. <?php
  2. // +-----------------------------------------------------------------
  3. // | Author: Tim Van Wassenhove <mailto: This e-mail address is being protected from spam bots, you need JavaScript enabled to view it />
  4. // | Site: <url:http://www.timvw.be/>
  5. // +-----------------------------------------------------------------
  6. // make sure we have time enough to execute this script
  7.  
  8. // connect to the ftp server
  9. $ftp = ftp_connect('ftp.scarlet.be');
  10. ftp_login($ftp, 'anonymous', 'password');
  11.  
  12. // get the files that are available here
  13. $local = glob('*.*');
  14.  
  15. // get the files that are available there
  16. $remote = ftp_nlist($ftp, '.');
  17.  
  18. // get the files there that are not availble here
  19. foreach($remote as $file)
  20. {
  21.   if (!in_array($file, $local))
  22.   {
  23.     // we don’t have the file, thus download it
  24.     ftp_get($ftp, $file, $file, FTP_BINARY);
  25.   }
  26. }
  27.  
  28. // close the connection
  29. ftp_close($ftp);
  30. ?>

 

 

Directory Stats

There are 1036 listing and 46 categories in our website

Change Language