Send file FTP over SSL with custom port number
Posted
by JM4
on Stack Overflow
See other posts from Stack Overflow
or by JM4
Published on 2010-05-25T23:52:06Z
Indexed on
2010/05/26
0:01 UTC
Read the original article
Hit count: 232
I have asked the question before but in a different manner. I am trying taking form data, compiling into a temporary CSV file and trying to send over to a client via FTP over SSL (this is the only route I am interested in hearing solutions for unless there is a workaround to doing this, I cannot make changes). I have tried the following:
- ftp_connect - nothing happens, the page just times out
- ftp_ssl_connect - nothing happens, the page just times out
- curl library - same thing, given URL it also gives error.
I am given the following information:
- FTPS Server IP Address
- TCP Port (1234)
- Username
- Password
- Data Directory to dump file
- FTP Mode: Passive
very, very basic code (which I believe should initiate a connection at minimum): Code:
<?php
$ftp_server = "00.000.00.000"; //masked for security
$ftp_port = "1234"; // masked but not 990
$ftp_user_name = "username";
$ftp_user_pass = "password";
// set up basic ssl connection
$conn_id = ftp_ssl_connect($ftp_server, $ftp_port, "20");
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
echo ftp_pwd($conn_id); // /
echo "hello";
// close the ssl connection
ftp_close($conn_id);
?>
When I run this over a SmartFTP client, everything works just fine. I just can't get it to work using PHP (which is a necessity). Has anybody had success doing this in the past? I would be very interested to hear your approach.
© Stack Overflow or respective owner