FTPサーバに接続してコマンドを実行します:
<?php
// connect to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
// the two lines below is the same as: ftp_login($ftp_conn,"john","secretpassword");
ftp_raw($ftp_conn, "USER john");
ftp_raw($ftp_conn, "PASS secretpassword");
?>
ftp_raw() 関数は、生のコマンドをFTPサーバに送信します。
ftp_raw(ftp_connection,command);
パラメータ | 説明 |
---|---|
ftp_connection | 必須。 使用するFTP接続を指定する |
command | 必須。実行するコマンドを指定する |
返り値: | サーバの応答を文字列の配列として返します |
---|---|
PHP バージョン: | 5+ |