connect() public method

Opens a FTP connection
public connect ( string $host, integer $port = 21, integer $timeout = 90 ) : resource
$host string
$port integer
$timeout integer
return resource
Example #1
0
 /**
  * Open a FTP connection.
  *
  * @param string $host
  * @param bool   $ssl
  * @param int    $port
  * @param int    $timeout
  *
  * @return FTPClient
  * @throws FtpException If unable to connect
  */
 public function connect($host, $ssl = false, $port = 21, $timeout = 90)
 {
     if ($ssl) {
         $this->conn = @$this->ftp->ssl_connect($host, $port, $timeout);
     } else {
         $this->conn = @$this->ftp->connect($host, $port, $timeout);
     }
     if (!$this->conn) {
         throw new FtpException('Unable to connect');
     }
     return $this;
 }