PHP ftp_connect() Function

PHP ftp_connect() Function


Define : 

In this tutorial we have to learn about PHP ftp_connect() Function.The ftp_connect() Function is inbuilt function in php.This function is used to open FTP connection to the specified hostname.

Syntax of ftp_connect() Function : 

  ftp_connect(hostname, port, timeout)
Parameters
hostname Required. Specify the FTP server address. This parameter should not be prefixed with ftp:// or contain any trailing slashes.
port Optional. Specify an alternate port to connect to. If it is omitted or set to zero, then the default FTP port, 21, will be used.
timeout Optional. Specify the timeout in seconds for all subsequent network operations. Default is 90 seconds. The timeout can be changed and queried at any time with ftp_set_option() and ftp_get_option().

 Given below example to usage of PHP ftp_connect() Function :

Output : Successfully connected to www.webdesigninghouse.com! Connection closed successfully!