User Tools

Site Tools


php:implicit_ftps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
php:implicit_ftps [2021/03/11 16:31] – created Wulf Rajekphp:implicit_ftps [2023/05/29 11:55] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Implicit FTPS ======+====== 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:
  
 </code> </code>
 +
 +===== Explicit FTPS =====
 +
 +The code below contains example of directory listing of an explicit FTPS server - the normal PHP FTP functions can be used:
 +
 +<code>
 +<?php
 +
 +$ftp_server="server";
 +$ftp_port="990";
 +$ftp_user_name="username";
 +$ftp_user_pass="password";
 +
 +// set up basic ssl connection
 +$conn_id = ftp_ssl_connect($ftp_server,$ftp_port);
 +
 +if(!$conn_id) {
 +    //could not connect
 +    die("can't connect to $ftp_server on port $ftp_port\n");
 +}
 +
 +// login with username and password
 +$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
 +
 +if (!$login_result) {
 +    // PHP will already have raised an E_WARNING level message in this case
 +    die("can't login\n");
 +}
 +
 +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);
 +
 +</code>
 +
php/implicit_ftps.1615480318.txt.gz · Last modified: 2023/05/29 11:53 (external edit)