PHP ftp_get_option() function

Definition and Usage

The ftp_get_option() function returns various different option settings of the current FTP connection.

Syntax

ftp_get_option(ftp_connection,option)
Parameters Description
ftp_connection Required. Specifies the FTP connection to use (identifier of the FTP connection).
option

Required. Specifies the option to return. Possible values include:

  • FTP_TIMEOUT_SEC - Returns the time limit for network operations
  • FTP_AUTOSEEK - If this option is set, it will return true, otherwise false

Description

If successful, it will return the value of the option, otherwise, if the given parameter option If the option is not supported, it will return false and also prompt an error message.

This function will return the connection handle for ftp_connection, specify key value option value.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_get_option($conn,FTP_TIMEOUT_SEC);
ftp_close($conn);
?>

Output:

90