我如何:PHP ftp_echo
Ubuntu.SE 上我的问题的变体:
这(基本上)是我在做的事情我登录到 FTP:
ftp user:password@server
ftp: user:password@server: Unknown host
ftp> echo HELLO WORLD!
ftp> quit
是否可以在 PHP 中通过 ftp“回显”?
<?php
$ftp_server = "server";
$ftp_user_name = "user";
$ftp_user_pass = "SuperSecretPassword";
$message = "Hello World!";
// connect
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Echo Message
$upload = ftp_echo($conn_id, $message);
// close the FTP stream
ftp_close($conn_id);
?>
也许我是个白痴,但我看到的所有命令都是用于在本地推送、拉动或执行操作。是否有其他东西充当“ftp”? echo“Hello World!”’而我是否在没有意识到的情况下正看着它?
Variation of my question on Ubuntu.SE:
This is (basically) what I'm doing when I log into a FTP:
ftp user:password@server
ftp: user:password@server: Unknown host
ftp> echo HELLO WORLD!
ftp> quit
Is it possible to "echo" over ftp in PHP?
<?php
$ftp_server = "server";
$ftp_user_name = "user";
$ftp_user_pass = "SuperSecretPassword";
$message = "Hello World!";
// connect
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Echo Message
$upload = ftp_echo($conn_id, $message);
// close the FTP stream
ftp_close($conn_id);
?>
Maybe I'm an idiot, but all the commands I see are for pushing, pulling or doing stuff locally. Does something else act as 'ftp> echo "Hello World!"' and am I'm looking right at it without realizing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你想要 ftp_raw。您可以使用它向您的 ftp 服务器发送任意命令。
I think you want ftp_raw. You'd use this to put an arbitrary command to your ftp server.