如何通过安全 FTP SSL 协议发送文件

发布于 2024-09-01 12:21:53 字数 400 浏览 5 评论 0原文

我感谢您就该主题提供的任何帮助。在线注册结束时,我将获取客户数据(多个字段),将它们放入 CSV 文件中,并尝试通过 SSL 协议提交给另一个客户端,但不知道这是如何完成的。我还将信息存储在本地数据库中,希望这个过程有点相似。

我已经收到了来自 php.net SSN2

但说实话,这对我来说就像读中文一样。我不理解这些说明,也不打算安装任何扩展、修改 PHP.ini 文件或任何类似的内容(特别是因为我们不拥有发送信息的服务器)。

是否有一种简单、安全的方法将此文件传输到提供给我们的 SSL 协议?

谢谢!

I appreciate any help that can be offered on the subject. At the end of an online enrollment, I am taking customer data (several fields), putting them in a CSV file and trying to submit to another client over SSL protocol but have no idea how this is done. I am also storing the information on a local database and am hoping the process is somewhat similar.

I have already been sent links to view the SSH2 instructions from php.net SSN2

but to be honest this is like reading Chinese to me. I do not understand the instructions and am not looking to install any extensions, modify the PHP.ini file or anything of the sort (especially since we do not own the server the information is being sent through).

Is there a simple, secure way of transmitting this file to the SSL protocol provided to us?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光礼记 2024-09-08 12:21:53

也许您可以使用 ftp_ssl_connect 来解决这个问题,它用于打开安全的 SSL-FTP 连接,并且上传文件只是一个简单的过程,只需创建连接到服务器,然后将文件放在那里。一个基本示例可以是:

//Create your connection
$ftp_conn = ftp_ssl_connect( $host, $you_can_provide_a_port );

//Login
$login_result = ftp_login($ftp_conn, $user, $pass);

if( $login_result )
{
    //Set passive mode
    ftp_pasv( $ftp_conn, true );
    // Transfer file
    $transfer_result = ftp_put( $ftp_conn, $dest_file_path, $source_file_path, FTP_BINARY );

    //Verify if transfer was successfully made
    if( $transfer_result)
    {
        echo "Success";
    }
    else
    {
        echo "An error occured";
    }
}

出于参考目的 http://www. php.net/manual/en/function.ftp-ssl-connect.php

Perhaps you could use ftp_ssl_connect for that matter, which is used to open a secure SSL-FTP connection, and to upload a file is just a straight forward process, just create the connection to the server, and put the file up there. A basic example could be:

//Create your connection
$ftp_conn = ftp_ssl_connect( $host, $you_can_provide_a_port );

//Login
$login_result = ftp_login($ftp_conn, $user, $pass);

if( $login_result )
{
    //Set passive mode
    ftp_pasv( $ftp_conn, true );
    // Transfer file
    $transfer_result = ftp_put( $ftp_conn, $dest_file_path, $source_file_path, FTP_BINARY );

    //Verify if transfer was successfully made
    if( $transfer_result)
    {
        echo "Success";
    }
    else
    {
        echo "An error occured";
    }
}

For reference purposes http://www.php.net/manual/en/function.ftp-ssl-connect.php

笑红尘 2024-09-08 12:21:53

我设法使用 php 通过 SSL 进行 ftp 的唯一方法是使用 php 的 exec() 函数来执行 curl< /a> 命令。 PHP 的curl 库无法工作,因为当时skip-pasv-ip 选项不存在,而它是绝对必需的。例如:

curl --user <username:password> --disable-epsv --ftp-pasv --ftp-skip-pasv-ip --ftp-ssl --sslv2  --cert <path/to/certificate> -T <path/to/uploadfile> <hostname>

您可能需要修改卷曲选项以满足您的需求。

The only way I've managed to do ftp over SSL using php was to use php's exec() function to execute a curl command. PHP's curl library would not work because at the time, the skip-pasv-ip option did not exist and it was something that was absolutely required. Something like:

curl --user <username:password> --disable-epsv --ftp-pasv --ftp-skip-pasv-ip --ftp-ssl --sslv2  --cert <path/to/certificate> -T <path/to/uploadfile> <hostname>

You may need to modify the curl options to suit your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文