note 89988 deleted from function.ftp-ssl-connect by danbrown
| From: | danbrown@php.net | Date: | Fri, 13 Nov 2009 23:20:34 +0000 |
| Subject: | note 89988 deleted from function.ftp-ssl-connect by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162885@lists.php.net to get a copy of this message | ||
Note Submitter: steveh at i12 dot com
----
I don't believe the ftps implementation handles implicit ssl connections, having spent 2 days
messing to get it to work in both php4 and 5. There is no mention of explicit vs implicit in the
docs which backs this up.
I therefore ended up using an alternative ftp implementation class to successfully connect to an
implicit ssl ftp server.
It is a php5 class. You can download the class file here:
http://kacke.de/php_samples/source.php?f=ftp.cls.php
It is fairly self explanatory if you read the public functions. Here's a usage example:
<?php
include "ftp.cls.php";
$ftpconn= new ftp();
$ftpconn->debug=true; //Comment out or set to false for silent mode!
// set up basic ssl connection
if(!$ftpconn->ftp_connect("your_ftps_host.com",990,"SSL")) //990 is the
standard implicit ssl port
{
echo "Error: <br/>Unable to open SSL connection<br />";
} else {
// login with username and password
if($ftpconn->ftp_login("username", "password"))
{
//Change the directory
$ftpconn->ftp_chdir("/parent/child");
//Upload the file
$ftpconn->ftp_put("remotenamehere.txt",
"pathtofile/localfilenamehere.txt");
$ftpconn->ftp_quit();
echo "Upload Done.<br />";
} else {
echo "Error:<br/>Unabe to login in.<br />";
}
}
?>
Thank you Topi for getting me out of a hole!