public function FTPExtension::connect in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/FileTransfer/FTPExtension.php \Drupal\Core\FileTransfer\FTPExtension::connect()
Connects to the server.
Overrides FileTransfer::connect
File
- core/
lib/ Drupal/ Core/ FileTransfer/ FTPExtension.php, line 18 - Contains \Drupal\Core\FileTransfer\FTPExtension.
Class
- FTPExtension
- Defines a file transfer class using the PHP FTP extension.
Namespace
Drupal\Core\FileTransferCode
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");
}
}