fopen
(PHP 3, PHP 4 )
fopen -- Opens file or URL
Description
resource fopen ( string filename, string mode [, int use_include_path
[, resource zcontext]])
fopen() binds a named resource, specified by filename, to
a stream. If filename is of the form "scheme://...",
it is assumed to be a URL and PHP will search for a protocol
handler (also known as a wrapper) for that scheme. If no
wrappers for that protocol are registered, PHP will emit
a notice to help you track potential problems in your script
and then continue as though filename specifies a regular
file.
If PHP has decided that filename specifies a local file,
then it will try to open a stream on that file. The file
must be accessible to PHP, so you need to ensure that the
file access permissions allow this access. If you have enabled
safe mode, or open_basedir further restrictions may apply.
If PHP has decided that filename specifies a registered
protocol, and that protocol is registered as a network URL,
PHP will check to make sure that allow_url_fopen is enabled.
If it is switched off, PHP will emit a warning and the fopen
call will fail.
Note: The list of supported protocols can be found in Appendix
J. Some protocols (also referred to as wrappers) support
context and/or php.ini options. Refer to the specific page
for the protocol in use for a list of options which can
be set. ( i.e. php.ini value user_agent used by the http
wrapper) For a description of contexts and the zcontext
parameter , refer to Reference CV, Stream Functions.
Note: Context support was added with PHP 5.0.0.
|