O'Reilly logo

Webbots, Spiders, and Screen Scrapers by Michael Schrenk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

PHP and FTP

PHP provides built-in functions that closely resemble standard FTP commands. In addition to transferring files, PHP allows your scripts to perform many administrative functions. Table 13-1 lists the most useful FTP commands supported by PHP.

Table 13-1. Common FTP Commands Supported by PHP

FTP Function (Where $ftp Is the FTP File Stream)

Usage

ftp_cdup($ftp);

Makes the parent directory the current directory

ftp_chdir ($ftp, "directory/path")

Changes the current directory

ftp_delete ($ftp, "file_name")

Deletes a file

ftp_get ($ftp, "local file", "remote file", MODE)

Copies the remote file to the local file where MODE indicates if the remote file is FTP_ASCII or FTP_BINARY

ftp_mkdir($ftp, "directory name")

Creates a new directory

ftp_rename($ftp, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required