note 37331 deleted from function.ftp-connect by googleguy
| From: | googleguy@php.net | Date: | Sat, 19 Sep 2015 21:58:21 +0000 |
| Subject: | note 37331 deleted from function.ftp-connect by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203819@lists.php.net to get a copy of this message | ||
Note Submitter: rainer at justchords dot com
----
Connecting through a firewall also depends on the type. This is an example for the Secure Gateway
FTP. First you have to connect to the firewall, then open a session to the destination ftp server.
This looks like this:
// Connect to firewall
$conn_id = ftp_connect("firewall.yournet.com");
// Open a session to an external ftp site
$login_result = ftp_login ($conn_id, "userid@externalhost.com", "password");
// Check open
if ((!$conn_id) || (!$login_result)) {
echo "Ftp-connect failed!"; die;
} else {
echo "Connected.";
}
// turn on passive mode transfers
ftp_pasv ($conn_id, true) ;
... and go on ...