php:implicit_ftps
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| php:implicit_ftps [2021/03/11 16:31] – created Wulf Rajek | php:implicit_ftps [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== FTPS ====== |
| + | |||
| + | ===== Implicit FTPS ===== | ||
| The code below contains examples to upload, download and delete files on an implicit FTPS server and to get a directory listing: | The code below contains examples to upload, download and delete files on an implicit FTPS server and to get a directory listing: | ||
| Line 100: | Line 102: | ||
| </ | </ | ||
| + | |||
| + | ===== Explicit FTPS ===== | ||
| + | |||
| + | The code below contains example of directory listing of an explicit FTPS server - the normal PHP FTP functions can be used: | ||
| + | |||
| + | < | ||
| + | <?php | ||
| + | |||
| + | $ftp_server=" | ||
| + | $ftp_port=" | ||
| + | $ftp_user_name=" | ||
| + | $ftp_user_pass=" | ||
| + | |||
| + | // set up basic ssl connection | ||
| + | $conn_id = ftp_ssl_connect($ftp_server, | ||
| + | |||
| + | if(!$conn_id) { | ||
| + | //could not connect | ||
| + | die(" | ||
| + | } | ||
| + | |||
| + | // login with username and password | ||
| + | $login_result = ftp_login($conn_id, | ||
| + | |||
| + | if (!$login_result) { | ||
| + | // PHP will already have raised an E_WARNING level message in this case | ||
| + | die(" | ||
| + | } | ||
| + | |||
| + | echo ftp_pwd($conn_id); | ||
| + | |||
| + | // get contents of the current directory | ||
| + | $contents = ftp_nlist($conn_id, | ||
| + | |||
| + | // output $contents | ||
| + | var_dump($contents); | ||
| + | |||
| + | // close the ssl connection | ||
| + | ftp_close($conn_id); | ||
| + | |||
| + | </ | ||
| + | |||
php/implicit_ftps.1615480318.txt.gz · Last modified: (external edit)