ngyuki / php-ftp-client
php-ftp-client
v1.0.0
2013-04-10 12:05 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-11-11 01:28:28 UTC
README
FTP client library that does not depend on FTP extension.
Install
$ php composer.phar require "ngyuki/php-ftp-client:*"
Requirements
- PHP 5.3.0 or later
Example
<?php require __DIR__ . '/../vendor/autoload.php'; use ngyuki\FtpClient\FtpClient; use ngyuki\FtpClient\FtpException; use ngyuki\FtpClient\TransportException; $ftp = new FtpClient(); try { $ftp->connect("example.net", 21, 10); $ftp->login("hoge", "piyo"); echo "nlist...\n"; echo implode("\n", $ftp->nlist(".")); echo "\n\n"; echo "put...\n"; $ftp->put("test.txt", "testing"); $ftp->quit(); echo "done.\n"; } catch (FtpException $ex) { echo "FtpException: {$ex->getResponse()->getResponseLine()}\n"; } catch (TransportException $ex) { echo "TransportException: {$ex->getMessage()}\n"; }