note 89988 added to function.ftp-ssl-connect
| From: | steveh at i12 dot com | Date: | Wed, 01 Apr 2009 08:32:29 +0000 |
| Subject: | note 89988 added to function.ftp-ssl-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152682@lists.php.net to get a copy of this message | ||
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!
----
Server IP: 69.147.83.197
Probable Submitter: 86.159.7.2
----
Manual Page -- http://www.php.net/manual/en/function.ftp-ssl-connect.php
Edit -- https://master.php.net/note/edit/89988
Del: integrated -- https://master.php.net/note/delete/89988/integrated
Del: useless -- https://master.php.net/note/delete/89988/useless
Del: bad code -- https://master.php.net/note/delete/89988/bad+code
Del: spam -- https://master.php.net/note/delete/89988/spam
Del: non-english -- https://master.php.net/note/delete/89988/non-english
Del: in docs -- https://master.php.net/note/delete/89988/in+docs
Del: other reasons-- https://master.php.net/note/delete/89988
Reject -- https://master.php.net/note/reject/89988
Search -- https://master.php.net/manage/user-notes.php