I can't get this to connect to the FTP server for some odd reason, can anyone help me? What it does is tell me that it could not connect to the ftp server.
<?php
// connect and login to FTP server
$ftp_server = "serverip";
$ftp_port = "22";
$ftp_username = "vpslogin";
$ftp_userpass = "vpspassword";
$ftp_conn = ftp_connect($ftp_server,$ftp_port) or die("Could Not Connect To FTP Server: "$ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
$server_file = "directoy/listing";
// open local file to write to
$local_file = "local.txt";
$fp = fopen($local_file,"w");
// download server file and save it to open local file
if (ftp_fget($ftp_conn, $fp, $server_file, FTP_ASCII, 0))
{
echo "Successfully written to $local_file.";
}
else
{
echo "Error downloading $server_file.";
}
// close connection and file handler
ftp_close($ftp_conn);
fclose($fp);
?>