direte/microftps

用于处理通过 cUrl 的 FTPS 连接的微库

dev-master 2016-10-21 08:04 UTC

This package is not auto-updated.

Last update: 2024-10-02 20:30:26 UTC


README

用于处理通过 cUrl 的 FTPS 连接的微库

为什么?

  • 旧的“不可升级”的客户服务器
  • 默认的显式 ftp_ssl_connect 出现常见的 data_accept: SSL/TLS handshake failed 错误
  • 需要快速解决方案

解决方案

原始 FTPS (非 SFTP) 通过 cUrl 连接

用法

$someOpts = array(
  'passive' => true,
  'port' => 990,
  'timeout' => 10,
  'curlOptions' => array(
    'CURLOPT_SSL_VERIFYPEER' => true
  )
);

$mf = new \DiRete\MicroFtps();
$mf->connect('ftps.server.com', 'username', 'pass', $someOpts);
// Or $mf = new \DiRete\MicroFtps('ftps.server.com', 'username', 'pass', $someOpts);
$fileContent = $mf->read('/path/to/my/file.txt');

API (快速概述)

  • connect($server, $username, $password, $options)

  • read($filepath)

  • listDir($filepath)

  • write($remoteFilename, $localFilename)

  • delete($filepath)

贡献

欢迎 Pull Requests

许可

MIT