public function FileTransferFTPExtension::connect

public FileTransferFTPExtension::connect()

Connect to the server.

Overrides FileTransfer::connect

File

includes/filetransfer/ftp.inc, line 53

Class

FileTransferFTPExtension

Code

public function connect() {
  $this->connection = ftp_connect($this->hostname, $this->port);

  if (!$this->connection) {
    throw new FileTransferException("Cannot connect to FTP Server, check settings");
  }
  if (!ftp_login($this->connection, $this->username, $this->password)) {
    throw new FileTransferException("Cannot log in to FTP server. Check username and password");
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!filetransfer!ftp.inc/function/FileTransferFTPExtension::connect/7.x