$ftp_server = "*.*.*.*";
$ftp_user = "lu";
$ftp_pass = "love you";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("couldn't connect to $ftp_server");
$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
if ((!$conn_id) || (!$login_result)) {
echo "ftp connection has failed!";
echo "attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "connected to $ftp_server, for user $ftp_user_name";
}
// try to login
$filename=date('ymd').".xml";
$source_file="/usr/local/ivr/sendwireless/xml/data/".$filename; //源地址
echo $source_file;
$destination_file="/itc/admin/logstat/ftplog/".$filename; //目标地址
$upload = ftp_put($conn_id, $destination_file, $source_file, ftp_binary) or die("couldn't connect to $ftp_server");
ftp_quit($conn_id);
if (!$upload) {
echo "ftp upload has failed!";
} else {
echo "uploaded $source_file to $ftp_server as $destination_file";
}
ftp_close($conn_id);
新闻热点
疑难解答