Change language

PHP ftp_rawlist () function

Syntax:
ftp_rawlist ($ftp_connection, $directory, $recursive) 
Parameters:This function takes three parameter as above and described below:
  • $ftp_connection:Required. Indicates an existing FTP connection.
  • $directory:Required. It specifies the path to a directory on the remote server, i.e. on the FTP server whose file data is to be recovered. "./" is used for the current directory, "../" is used for the parent directory of the current directory. May contain an argument to the LIST command.
  • $recursive:This is an optional parameter. It specifies whether the command LIST or LIST -R will be sent to the server. If set to TRUE, it sends the LIST -R command. Sends the command LIST by default.
Return value:
  • On success:returns an array , each element of which corresponds to one line of text.
  • On failure:returns FALSE. In case, for example, when the wrong directory is passed.
Notes :
  • This function is available for PHP 4.0.0 and above new version.
  • The following examples cannot be run in the online IDE. So try running PHP on some hosting server or localhost with the correct ftp server name.
Example :  
/ / Connect to FTP server 
// Use correct FTP server $ftp_server = "localhost" ;  
// Use correct ftp username $ftp_username = "username" ;  
// Use correct FTP password matching
// to the ftp username $ftp_userpass = "password" ;  
// Setting up ftp connection $ftp_connection = ftp_connect ( $ftp_server ) or die ( "Could not connect to $ftp_server" ); if ( $ftp_connection ) { echo "successfully connected to the ftp server!" ; // Login to the established connection with // ftp user password $login = ftp_login ( $ftp_connection , $ftp_username , $ftp_userpass ); if ( $login ) { // Success check login // or not echo "
logged in successfully!"
; // Save data to $file_list $file_list = ftp_rawlist ( $ftp_connection , "/" ); // Print the raw array using print_r() print_r ( $file_list ); } else { echo "
login failed!"
; } // Close connection if (ftp_close ( $ftp_connection )) { echo "
Connection closed Successfully!"
; } }
?>
Output: Link : https://www.php.net/manual/en /function.ftp-rawlist.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method