TAILIEUCHUNG - PHP and MySQL Web Development - P80

PHP and MySQL Web Development - P80: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Using FTP 367 Listing Continued ftp_quit conn exit echo Logged in as user br check file times to see if an update is required echo Checking file time. br if file_exists localfile localtime filemtime localfile echo Local file last updated echo date G i j-M-Y localtime echo br else localtime 0 remotetime ftp_mdtm conn remotefile if remotetime 0 This doesn t mean the file s not there server may not support mod time echo Can t access remote file time. br remotetime localtime 1 make sure of an update else echo Remote file last updated echo date G i j-M-Y remotetime echo br if remotetime localtime echo Local copy is up to date. br exit download file echo Getting file from server. br fp fopen localfile w if success ftp_fget conn fp remotefile FTP_BINARY echo Error Could not download file ftp_quit conn exit 368 Chapter 17 Using Network and Protocol Functions Listing Continued fclose fp echo File downloaded successfully close connection to host ftp_quit conn body html The output from running this script on one occasion is shown in Figure . Figure The FTP mirroring script checks whether the local version of a file is up-to-date and downloads a new version if not. This is quite a generic ll see that it begins by setting up some variables host user anonymous password laura@ remotefile pub tsg teraterm localfile tmp writable The host variable should contain the name of the FTP server you want to connect to and the user and password correspond to the username and password you would like to log in with. Many FTP sites support what is called anonymous login that is a freely available username that anybody can use to connect. No password is required but it is a common courtesy to supply your email address as a password so that the system s administrators can see where their users are coming from. We have followed this convention here. The remotefile variable contains the path to the file we .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.