public function __construct($ftp, $user, $pass, $ssl = false)
{
if (!function_exists('ftp_connect')) {
throw new Exception('Error: The FTP extension is not available.');
} else {
if ($ssl) {
if (!($this->conn = ftp_ssl_connect($ftp))) {
throw new Exception('Error: There was an error connecting to the FTP server ' . $ftp);
}
} else {
if (!($this->conn = ftp_connect($ftp))) {
throw new Exception('Error: There was an error connecting to the FTP server ' . $ftp);
}
}
}
if (!ftp_login($this->conn, $user, $pass)) {
throw new Exception('Error: There was an error connecting to the FTP server ' . $ftp . ' with those credentials.');
}
}