puoi usare le funzioni ftp:
http://it.php.net/ftp

nella documentazione trovi vari esempi al riguardo.