Specifications

If the filename you use begins with ftp://, a passive mode FTP connection will be opened to
the server you specify and a pointer to the start of the file will be returned.
If the filename you use begins with http://, an HTTP connection will be opened to the server
you specify and a pointer to the response will be returned. When using HTTP mode, you must
specify trailing slashes on directory names, as shown in the following:
http://www.server.com/
not
http://www.server.com
When you specify the latter form of address (without the slash), a Web server will normally
use an HTTP redirect to send you to the first address (with the slash). Try it in your browser.
The fopen() function does not support HTTP redirects, so you must specify URLs that refer
to directories with a trailing slash.
Remember that the domain names in your URL are not case sensitive, but the path and file-
name might be.
Problems Opening Files
A common error you might make while trying to open a file is trying to open a file you dont
have permission to read or write to. PHP will give you a warning similar to the one shown in
Figure 2.2.
Storing and Retrieving Data
C
HAPTER 2
2
STORING AND
RETRIEVING DATA
55
FIGURE 2.2
PHP will specifically warn you when a file cant be opened.
04 7842 CH02 3/6/01 3:37 PM Page 55