Table of Contents

connect

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Client Class JFTP Method connect Reference connect() Never Work in Progress

This method makes the connection to the FTP server.

Syntax

boolean connect ( $host, $port )

$host string is a string containing the host to connect to. This parameter is optional and if omitted, defaults to ‘127.0.0.1’.
$port string is a string containing the port to connect to. This parameter is optional and if omitted defaults to ‘21’.

Examples

Example

jimport( 'joomla.connector.ftp' );

$ftp = new JFTP( array( 'type' => FTP_BINARY ) );

if ($ftp->connect( 'ftp.ftpserver.com' )) {
    echo "Connection successful!";
} else {
    echo "Connection failed!";
}

might produce:

Result

Connection successful!