你可以使用PHP的FTP Capabilities遠程連接到服務器,並獲得一個目錄列表:
// set up basic connection
$conn_id = ftp_connect('otherserver.example.com');
// login with username and password
$login_result = ftp_login($conn_id, 'username', 'password');
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
exit;
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// Retrieve directory listing
$files = ftp_nlist($conn_id, '/remote_dir');
// close the FTP stream
ftp_close($conn_id);
是的,但是執行opendir應該只是罰款... :( – Manu 2012-04-19 11:57:14
FTP_CONNECT連接罰款(由系統的警告後,防火牆),但我不想重寫我的整個腳本:( – Manu 2012-04-19 12:39:28
@Manu - 那麼等待其他用戶,如果他們爲您提供替代解決方案(如果存在?!)。我試圖幫助你,以及快速因爲我能夠......我很抱歉,它不是你要找的東西: -/ – 2012-04-19 12:43:04