diff --git a/language/wrappers.xml b/language/wrappers.xml index 9890c9f8bd..77df1ac128 100644 --- a/language/wrappers.xml +++ b/language/wrappers.xml @@ -1,1773 +1,40 @@ - - List of Supported Protocols/Wrappers - - PHP comes with many built-in wrappers for various URL-style protocols - for use with the filesystem functions such as fopen - and copy. In addition to these wrappers, you can as of - PHP 4.3.0, write your own wrappers using the stream_wrapper_register - function. - - - The URL syntax used to describe a wrapper only supports the scheme://... syntax. - scheme:/ and scheme: syntaxes are not supported. - - - - List of context options is available in the chapter . - - -
- Filesystem - All versions of PHP. Explicitly using file:// since PHP 5.0.0. - - - /path/to/file.ext - relative/path/to/file.ext - fileInCwd.ext - C:/path/to/winfile.ext - C:\path\to\winfile.ext - \\smbserver\share\path\to\winfile.ext - file:///path/to/file.ext - - - - Filesystem is the default wrapper used with PHP and represents the local filesystem. - When a relative path is specified (a path which does not begin with /, \, \\, or a Windows drive letter) - the path provided will be applied against the current working directory. In many cases this is the - directory in which the script resides unless it has been changed. Using the CLI sapi, this defaults - to the directory from which the script was called. - - - - With some functions, such as fopen and file_get_contents, - include_path may be optionally searched for relative paths as well. - + + Supported Protocols and Wrappers + - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Allows Reading - Yes - - - Allows Writing - Yes - - - Allows Appending - Yes - - - Allows Simultaneous Reading and Writing - Yes - - - Supports stat - Yes - - - Supports unlink - Yes - - - Supports rename - Yes - - - Supports mkdir - Yes - - - Supports rmdir - Yes - - - -
+ PHP comes with many built-in wrappers for various URL-style protocols + for use with the filesystem functions such as fopen, + copy, file_exists and + filesize. + In addition to these wrappers, it is possible to register custom wrappers + using the stream_wrapper_register function.
-
- - -
- HTTP and HTTPS - PHP 4, PHP 5. https:// since PHP 4.3.0 - - - http://example.com - http://example.com/file.php?var1=val1&var2=val2 - http://user:password@example.com - https://example.com - https://example.com/file.php?var1=val1&var2=val2 - https://user:password@example.com - - - Allows read-only access to files/resources via HTTP 1.0, - using the HTTP GET method. A Host: header is sent with the request - to handle name-based virtual hosts. If you have configured - a user_agent string using - your &php.ini; file or the stream context, it will also be included - in the request. - - &warn.ssl-non-standard; - - Redirects have been supported since PHP 4.0.5; if you are using - an earlier version you will need to include trailing slashes in - your URLs. If it's important to know the URL of the resource where - your document came from (after all redirects have been processed), - you'll need to process the series of response headers returned by the - stream. - - - - -]]> - - - - The stream allows access to the body of - the resource; the headers are stored in the - $http_response_header variable. - Since PHP 4.3.0, the headers are available using - stream_get_meta_data. - - - HTTP connections are read-only; you cannot write data or copy - files to an HTTP resource. - - - HTTPS is supported starting from PHP 4.3.0, if you - have compiled in support for OpenSSL. - - - - If you have set the from directive - in &php.ini;, and do not define a From: header - in the , then this value will be sent as the - From: header in the HTTP request. - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - Yes - - - Allows Reading - Yes - - - Allows Writing - No - - - Allows Appending - No - - - Allows Simultaneous Reading and Writing - N/A - - - Supports stat - No - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
- - - Custom headers may be sent with an HTTP request prior to - version 5 by taking advantage of a side-effect in the - handling of the user_agent INI setting. - Set user_agent to any valid string - (such as the default PHP/version setting) - followed by a carriage-return/line-feed pair and any - additional headers. - This method works in PHP 4 and all later versions. - - - - Sending custom headers with an HTTP request - - -]]> - - Results in the following request being sent: - - - - - -
- - -
- FTP and FTPS - PHP 4, PHP 5. ftps:// since PHP 4.3.0 - - - ftp://example.com/pub/file.txt - ftp://user:password@example.com/pub/file.txt - ftps://example.com/pub/file.txt - ftps://user:password@example.com/pub/file.txt - - - - Allows read access to existing files and creation of new files - via FTP. If the server does not support passive mode ftp, the - connection will fail. - - - You can open files for either reading or writing, but not both - simultaneously. If the remote file already exists on the ftp - server and you attempt to open it for writing but have not specified - the context option overwrite, the connection - will fail. If you need to overwrite existing files over ftp, - specify the overwrite option in the context - and open the file for writing. Alternatively, you can - use the FTP extension. - - - Appending - - As of PHP 5.0.0 files may be appended via the - ftp:// URL wrapper. In prior versions, attempting - to append to a file via ftp:// will result in failure. - - - - ftps:// was introduced in PHP 4.3.0. - It is the same as ftp://, - but attempts to negotiate a secure connection with the ftp server. - If the server does not support SSL, then the connection falls back - to regular unencrypted ftp. - - - FTPS is supported starting from PHP 4.3.0, if you - have compiled in support for OpenSSL. - - - - If you have set the from directive - in &php.ini;, then this value will be sent as the anonymous FTP - password. - - - - Wrapper Summary - - - - Attribute - PHP 4 - PHP 5 - - - - - Restricted by allow_url_fopen - Yes - Yes - - - Allows Reading - Yes - Yes - - - Allows Writing - Yes (new files only) - Yes (new files/existing files with overwrite) - - - Allows Appending - No - Yes - - - Allows Simultaneous Reading and Writing - No - No - - - Supports stat - No - - As of PHP 5.0.0: filesize, - filetype, file_exists, - is_file, and is_dir elements only. - As of PHP 5.1.0: filemtime. - - - - Supports unlink - No - Yes - - - Supports rename - No - Yes - - - Supports mkdir - No - Yes - - - Supports rmdir - No - Yes - - - -
-
-
- -
- PHP input/output streams - - - php://stdin - php://stdout - php://stderr - php://output - php://input - php://filter (available since PHP 5.0.0) - php://memory (available since PHP 5.1.0) - php://temp (available since PHP 5.1.0) - - - - php://stdin, php://stdout - and php://stderr allow direct access to - the corresponding input or output stream of the PHP process. The stream - references a duplicate file descriptor, so if you open - php://stdin and later close it, you close only your - copy of the descriptor--the actual stream referenced by - STDIN is unaffected. Note that PHP exhibited buggy - behavior in this regard until PHP 5.2.1. It is recommended that you simply - use the constants STDIN, STDOUT - and STDERR instead of manually opening streams using - these wrappers. - - - php://output allows you to write to the - output buffer mechanism in the same way as - print and echo. - - - php://input allows you to read raw data - from the request body. - In case of POST requests, it preferrable to - $HTTP_RAW_POST_DATA as it does not depend on - special &php.ini; directives. Moreover, for those cases where - $HTTP_RAW_POST_DATA is not populated by - default, it is a potentially less memory intensive alternative - to activating always_populate_raw_post_data. - php://input is not available with - enctype="multipart/form-data". - - A stream opened with php://input can only be read - once; the stream does not support seek operations. However, depending - on the SAPI implementation, it may be possible to open another - php://input stream and restart reading. This is - only possible if the request body data has been saved. Typically, this - is the case for POST requests, but not other request methods, such as - PUT or PROPFIND. + The URL syntax used to describe a wrapper only supports the + scheme://... syntax. The scheme:/ + and scheme: syntaxes are not supported. - - php://stdin and - php://input are read-only, whereas - php://stdout, - php://stderr and - php://output are write-only. - - - - php://filter is a kind of meta-wrapper designed - to permit the application of filters to a stream at the time of - opening. This is useful with all-in-one file functions such as - readfile, file, and - file_get_contents where there is otherwise - no opportunity to apply a filter to the stream prior the contents - being read. - - - The php://filter target takes the following - 'parameters' as parts of its 'path'. - - - - - /resource=<stream to be filtered> - (required) This parameter must be located at - the end of your php://filter specification and - should point to the stream which you want filtered. - - - -]]> - - - - - - - /read=<filter list to apply to read chain> - (optional) This parameter takes one or more - filternames separated by the pipe character |. - - - -]]> - - - - - - - /write=<filter list to apply to write chain> - (optional) This parameter takes one or more - filternames separated by the pipe character |. - - - -]]> - - - - - - - /<filter list to apply to both chains> - (optional) Any filter lists which are not - prefixed specifically by read= or - write= will be applied to both the read and - write chains (as appropriate). - - - - - - The php://memory wrapper stores the data in the - memory. php://temp behaves similarly, but uses a - temporary file for storing the data when a certain memory limit is reached - (the default is 2 MB). - - - The php://temp wrapper takes the following - 'parameters' as parts of its 'path': - - - - - /maxmemory:<number of bytes> - (optional). This parameter allows changing the - default value for the memory limit (when the data is moved to a temporary - file). - - - -]]> - - - - - - - - - - Wrapper Summary (For <literal>php://filter</literal>, - refer to summary of wrapper being filtered.) - - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Restricted by allow_url_include - - php://input, - php://stdin, - php://memory and - php://temp only. - - - - Allows Reading - - php://stdin, - php://input, - php://memory and - php://temp only. - - - - Allows Writing - - php://stdout, - php://stderr, - php://output, - php://memory and - php://temp only. - - - - Allows Appending - - php://stdout, - php://stderr, - php://output, - php://memory and - php://temp only. (Equivalent to writing) - - - - Allows Simultaneous Reading and Writing - - php://memory and - php://temp only. - - - - Supports stat - - php://memory and - php://temp only. - - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - Supports stream_select - - php://stdin, php://stdout, - php://stderr and php://temp. - - - - -
-
-
- -
- Compression Streams - zlib: PHP 4.0.4 - PHP 4.2.3 (systems with fopencookie only) - compress.zlib:// and compress.bzip2:// PHP 4.3.0 and up - - - zlib: - compress.zlib:// - compress.bzip2:// - - - - zlib: works like gzopen, except that the - stream can be used with fread and the other - filesystem functions. This is deprecated as of PHP 4.3.0 due - to ambiguities with filenames containing ':' characters; use - compress.zlib:// instead. - - - - compress.zlib:// and - compress.bzip2:// are equivalent to - gzopen and bzopen - respectively, and operate even on systems that do not support - fopencookie. - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Allows Reading - Yes - - - Allows Writing - Yes - - - Allows Appending - Yes - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - - No, use the normal file:// wrapper - to stat compressed files. - - - - Supports unlink - - No, use the normal file:// wrapper - to unlink compressed files. - - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
- - ZIP extension registers zip: wrapper. - -
- -
- Data (RFC 2397) - - The data: (RFC - 2397) stream wrapper is available since PHP 5.2.0. - - - - Print data:// contents - - -]]> - - - - - Fetch the media type - - -]]> - - - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Restricted by allow_url_include - Yes - - - Allows Reading - Yes - - - Allows Writing - No - - - Allows Appending - No - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - No - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
-
- -
- Glob - - The glob: stream wrapper is available since PHP 5.3.0. - - - - Basic usage - -getFilename(), $f->getSize()/1024); -} -?> -]]> - - - - - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Restricted by allow_url_include - No - - - Allows Reading - No - - - Allows Writing - No - - - Allows Appending - No - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - No - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
-
- - -
- Phar - - The phar:// stream wrapper is available since - PHP 5.3.0. See Phar stream wrapper - for detailed description. - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Restricted by allow_url_include - No - - - Allows Reading - Yes - - - Allows Writing - Yes - - - Allows Appending - No - - - Allows Simultaneous Reading and Writing - Yes - - - Supports stat - Yes - - - Supports unlink - Yes - - - Supports rename - Yes - - - Supports mkdir - Yes - - - Supports rmdir - Yes - - - -
-
-
- - -
- Secure Shell 2 - - ssh2.shell:// - ssh2.exec:// - ssh2.tunnel:// - ssh2.sftp:// - ssh2.scp:// - PHP 4.3.0 and up (PECL) - - - - ssh2.shell://user:pass@example.com:22/xterm - ssh2.exec://user:pass@example.com:22/usr/local/bin/somecmd - ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14 - ssh2.sftp://user:pass@example.com:22/path/to/filename - - - - This wrapper is not enabled by default - - In order to use the ssh2.*:// wrappers you must install - the SSH2 extension - available from PECL. - - - - - In addition to accepting traditional URI login details, the ssh2 wrappers - will also reuse open connections by passing the connection resource in the - host portion of the URL. - - - - Opening a stream from an active connection - - -]]> - - - - - Wrapper Summary - - - - Attribute - ssh2.shell - ssh2.exec - ssh2.tunnel - ssh2.sftp - ssh2.scp - - - - - Restricted by allow_url_fopen - Yes - Yes - Yes - Yes - Yes - - - Allows Reading - Yes - Yes - Yes - Yes - Yes - - - Allows Writing - Yes - Yes - Yes - Yes - No - - - Allows Appending - No - No - No - Yes (When supported by server) - No - - - Allows Simultaneous Reading and Writing - Yes - Yes - Yes - Yes - No - - - Supports stat - No - No - No - Yes - No - - - Supports unlink - No - No - No - Yes - No - - - Supports rename - No - No - No - Yes - No - - - Supports mkdir - No - No - No - Yes - No - - - Supports rmdir - No - No - No - Yes - No - - - -
-
- - - - Context options - - - - Name - Usage - Default - - - - - session - Preconnected ssh2 resource to be reused - - - - sftp - Preallocated sftp resource to be reused - - - - methods - Key exchange, hostkey, cipher, compression, and MAC methods to use - - - - callbacks - - - - - username - Username to connect as - - - - password - Password to use with password authentication - - - - pubkey_file - Name of public key file to use for authentication - - - - privkey_file - Name of private key file to use for authentication - - - - env - Associate array of environment variables to set - - - - term - Terminal emulation type to request when allocating a pty - - - - term_width - Width of terminal requested when allocating a pty - - - - term_height - Height of terminal requested when allocating a pty - - - - term_units - Units to use with term_width and term_height - SSH2_TERM_UNIT_CHARS - - - -
-
- - -
+ -
- Rar - - rar:// - Available since PECL rar 3.0.0 - - - - rar://<url encoded archive name>[*][#[<url encoded entry name>]] - - - - This wrapper is not enabled by default - - In order to use the rar:// wrapper, you must install - the rar extension - available from PECL. - - - - - The wrapper takes the url encoded path to the RAR archive (relative or absolute), - an optional asterik (*), an optional number sign - (#) and an optional url encoded entry name, as stored in the - archive. Specifying an entry name requires the number sign; a leading forward - slash in the entry name is optional. - - - - This wrapper can open both files and directories. When opening directories, the - asterisk sign forces the directory entries names to be returned unencoded. If it's - not specified, they will be returned url encoded – the reason for this is to allow - the wrapper to be correctly used with built-in functionality like the - RecursiveDirectoryIterator in the presence of file names that seem like - url encoded data. - - - - If the pound sign and the entry name part are not included, the root of the archive - will be displayed. This differs from regular directories in that the resulting - stream will not contain information such as the modification time, as the root - directory is not stored in an inidivual entry in the archive. - The usage of the the wrapper with RecursiveDirectoryIterator requires - the number sign to be included in the URL when accessing the root, so that the - URLs of the children may be constructed correctly. - - - - - Traversing a RAR archive - -getSubPathName()) . - (is_dir(parent::current())?" [DIR]":""); - } -} - -$f = "rar://" . rawurlencode(dirname(__FILE__)) . - DIRECTORY_SEPARATOR . 'dirs_and_extra_headers.rar#'; - -$it = new RecursiveTreeIterator(new MyRecDirIt($f)); - -foreach ($it as $s) { - echo $s, "\n"; -} -?> -]]> - - &example.outputs.similar; - - - - - - - - Opening an encrypted file (header encryption) - - - array( - 'open_password' => 'samplepassword' - ) - ) - ) - ); -var_dump(stream_get_contents($stream)); -/* creation and last access date is opt-in in WinRAR, hence most - * files don't have them */ -var_dump(fstat($stream)); -?> -]]> - - &example.outputs.similar; - - 0 - [1] => 0 - [2] => 33206 - [3] => 1 - [4] => 0 - [5] => 0 - [6] => 0 - [7] => 26 - [8] => 0 - [9] => 1259550052 - [10] => 0 - [11] => -1 - [12] => -1 - [dev] => 0 - [ino] => 0 - [mode] => 33206 - [nlink] => 1 - [uid] => 0 - [gid] => 0 - [rdev] => 0 - [size] => 26 - [atime] => 0 - [mtime] => 1259550052 - [ctime] => 0 - [blksize] => -1 - [blocks] => -1 -) -]]> - - - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Restricted by allow_url_include - No - - - Allows Reading - Yes - - - Allows Writing - No - - - Allows Appending - No - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - Yes - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
- - - - Context options - - - - Name - Usage - Default - - - - - open_password - The password used to encrypt the headers of the archive, - if any. WinRAR will encrypt all the files with the same password - as the headers password when the later is present, so for archives - with encrypted headers, file_password will be - ignored. - - - - - file_password - The password used to encrypt a file, if any. If the headers - are also encrypted, this option will be ignored in favor of - open_password. The reason there are two options - is to cover the possibility of supporting archives with different - headers and file passwords, should those archives arise. Note that - if the archive does not have its headers encrypted, - open_password will be ignored and this option - must be used instead. - - - - - volume_callback - A callback to determine the path of missing volumes. See - RarArchive::open for more information. - - - - - -
-
- -
- - -
- Audio Streams - ogg:// PHP 4.3.0 and up (PECL) - - - ogg://soundfile.ogg - ogg:///path/to/soundfile.ogg - ogg://http://www.example.com/path/to/soundstream.ogg - - - - This wrapper is not enabled by default - - In order to use the ogg:// wrapper you must install - the OGG/Vorbis extension - available from PECL. - - - - - Files opened for reading via the ogg:// wrapper - are treated as compressed audio encoded using the OGG/Vorbis codec. - Similarly, files opened for writing or appending via the - ogg:// wrapper are writen as compressed audio data. - stream_get_meta_data, when used on an OGG/Vorbis - file opened for reading will return various details about the stream - including the vendor tag, any included - comments, the number of - channels, the sampling rate, - and the encoding rate range described by: - bitrate_lower, bitrate_upper, - bitrate_nominal, and bitrate_window. - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Allows Reading - Yes - - - Allows Writing - Yes - - - Allows Appending - Yes - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - No - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
- - - Context options - - - - Name - Usage - Default - Mode - - - - - pcm_mode - - PCM encoding to apply while reading, one of: - OGGVORBIS_PCM_U8, OGGVORBIS_PCM_S8, - OGGVORBIS_PCM_U16_BE, OGGVORBIS_PCM_S16_BE, - OGGVORBIS_PCM_U16_LE, and OGGVORBIS_PCM_S16_LE. - (8 vs 16 bit, signed or unsigned, big or little endian) - - OGGVORBIS_PCM_S16_LE - Read - - - rate - - Sampling rate of input data, expressed in Hz - - 44100 - Write/Append - - - bitrate - - When given as an integer, the fixed bitrate at which to encode. (16000 to 131072) - When given as a float, the variable bitrate quality to use. (-1.0 to 1.0) - - 128000 - Write/Append - - - channels - - The number of audio channels to encode, typically 1 (Mono), or 2 (Stero). - May range as high as 16. - - 2 - Write/Append - - - comments - - An array of string values to encode into the track header. - - - Write/Append - - - -
-
-
- - -
- Process Interaction Streams - expect:// PHP 4.3.0 and up (PECL) - - - expect://command - - - - This wrapper is not enabled by default - - In order to use the expect:// wrapper you must install - the Expect extension - available from PECL. - - - - - Streams opened via the expect:// wrapper provide - access to process'es stdio, stdout and stderr via PTY. - - - - - Wrapper Summary - - - - Attribute - Supported - - - - - Restricted by allow_url_fopen - No - - - Allows Reading - Yes - - - Allows Writing - Yes - - - Allows Appending - Yes - - - Allows Simultaneous Reading and Writing - No - - - Supports stat - No - - - Supports unlink - No - - - Supports rename - No - - - Supports mkdir - No - - - Supports rmdir - No - - - -
-
-
- -
+ &language.wrappers.file; + &language.wrappers.http; + &language.wrappers.ftp; + &language.wrappers.php; + &language.wrappers.compression; + &language.wrappers.data; + &language.wrappers.glob; + &language.wrappers.phar; + &language.wrappers.ssh2; + &language.wrappers.rar; + &language.wrappers.audio; + &language.wrappers.expect; + + + + + + ogg:// + Audio streams + + + + &reftitle.description; + + Files opened for reading via the ogg:// wrapper + are treated as compressed audio encoded using the OGG/Vorbis codec. + Similarly, files opened for writing or appending via the + ogg:// wrapper are writen as compressed audio data. + stream_get_meta_data, when used on an OGG/Vorbis + file opened for reading will return various details about the stream + including the vendor tag, any included + comments, the number of + channels, the sampling rate, + and the encoding rate range described by: + bitrate_lower, bitrate_upper, + bitrate_nominal, and bitrate_window. + + + ogg:// PHP 4.3.0 and up (PECL) + + This wrapper is not enabled by default + + In order to use the ogg:// wrapper you must install + the OGG/Vorbis extension + available from PECL. + + + + + + &reftitle.options; + + ogg://soundfile.ogg + ogg:///path/to/soundfile.ogg + ogg://http://www.example.com/path/to/soundstream.ogg + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Allows Reading + Yes + + + Allows Writing + Yes + + + Allows Appending + Yes + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + No + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+ + + + Context options + + + + Name + Usage + Default + Mode + + + + + pcm_mode + + PCM encoding to apply while reading, one of: + OGGVORBIS_PCM_U8, OGGVORBIS_PCM_S8, + OGGVORBIS_PCM_U16_BE, OGGVORBIS_PCM_S16_BE, + OGGVORBIS_PCM_U16_LE, and OGGVORBIS_PCM_S16_LE. + (8 vs 16 bit, signed or unsigned, big or little endian) + + OGGVORBIS_PCM_S16_LE + Read + + + rate + + Sampling rate of input data, expressed in Hz + + 44100 + Write/Append + + + bitrate + + When given as an integer, the fixed bitrate at which to encode. (16000 to 131072) + When given as a float, the variable bitrate quality to use. (-1.0 to 1.0) + + 128000 + Write/Append + + + channels + + The number of audio channels to encode, typically 1 (Mono), or 2 (Stero). + May range as high as 16. + + 2 + Write/Append + + + comments + + An array of string values to encode into the track header. + + + Write/Append + + + +
+
+
+ + + &reftitle.examples; + + +
+ + + diff --git a/language/wrappers/compression.xml b/language/wrappers/compression.xml new file mode 100644 index 0000000000..e3dba5a461 --- /dev/null +++ b/language/wrappers/compression.xml @@ -0,0 +1,131 @@ + + + + + + zlib, bzip2 and zip + Compression Streams + + + + &reftitle.description; + zlib: PHP 4.0.4 - PHP 4.2.3 (systems with fopencookie only) + compress.zlib:// and compress.bzip2:// PHP 4.3.0 and up + + + zlib: works like gzopen, except that the + stream can be used with fread and the other + filesystem functions. This is deprecated as of PHP 4.3.0 due + to ambiguities with filenames containing ':' characters; use + compress.zlib:// instead. + + + + compress.zlib:// and + compress.bzip2:// are equivalent to + gzopen and bzopen + respectively, and operate even on systems that do not support + fopencookie. + + + ZIP extension registers zip: wrapper. + + + + + &reftitle.options; + + zlib: + compress.zlib:// + compress.bzip2:// + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Allows Reading + Yes + + + Allows Writing + Yes + + + Allows Appending + Yes + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + + No, use the normal file:// wrapper + to stat compressed files. + + + + Supports unlink + + No, use the normal file:// wrapper + to unlink compressed files. + + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+
+ +
+ + + diff --git a/language/wrappers/data.xml b/language/wrappers/data.xml new file mode 100644 index 0000000000..3a885eabc2 --- /dev/null +++ b/language/wrappers/data.xml @@ -0,0 +1,140 @@ + + + + + + data:// + Data (RFC 2397) + + + + &reftitle.description; + + The data: (RFC + 2397) stream wrapper is available since PHP 5.2.0. + + + + + &reftitle.options; + + data://text/plain;base64, + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Restricted by allow_url_include + Yes + + + Allows Reading + Yes + + + Allows Writing + No + + + Allows Appending + No + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + No + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+
+ + + &reftitle.examples; + + Print data:// contents + + +]]> + + + + + Fetch the media type + + +]]> + + + + +
+ + + diff --git a/language/wrappers/expect.xml b/language/wrappers/expect.xml new file mode 100644 index 0000000000..c04587feba --- /dev/null +++ b/language/wrappers/expect.xml @@ -0,0 +1,119 @@ + + + + + + expect:// + Process Interaction Streams + + + + &reftitle.description; + + Streams opened via the expect:// wrapper provide + access to process'es stdio, stdout and stderr via PTY. + + + This wrapper is not enabled by default + + In order to use the expect:// wrapper you must install + the Expect extension + available from PECL. + + + expect:// PHP 4.3.0 and up (PECL) + + + + &reftitle.options; + + expect://command + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Allows Reading + Yes + + + Allows Writing + Yes + + + Allows Appending + Yes + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + No + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+
+ + + &reftitle.examples; + + +
+ + + diff --git a/language/wrappers/file.xml b/language/wrappers/file.xml new file mode 100644 index 0000000000..f0da00d33a --- /dev/null +++ b/language/wrappers/file.xml @@ -0,0 +1,143 @@ + + + + + + Filesystem + Accessing local filesystem + + + + &reftitle.description; + + Filesystem is the default wrapper used with PHP and represents the local filesystem. + When a relative path is specified (a path which does not begin with /, \, \\, or a Windows drive letter) + the path provided will be applied against the current working directory. In many cases this is the + directory in which the script resides unless it has been changed. Using the CLI sapi, this defaults + to the directory from which the script was called. + + + With some functions, such as fopen and file_get_contents, + include_path may be optionally searched for relative paths as well. + + + + + &reftitle.options; + + /path/to/file.ext + relative/path/to/file.ext + fileInCwd.ext + C:/path/to/winfile.ext + C:\path\to\winfile.ext + \\smbserver\share\path\to\winfile.ext + file:///path/to/file.ext + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Allows Reading + Yes + + + Allows Writing + Yes + + + Allows Appending + Yes + + + Allows Simultaneous Reading and Writing + Yes + + + Supports stat + Yes + + + Supports unlink + Yes + + + Supports rename + Yes + + + Supports mkdir + Yes + + + Supports rmdir + Yes + + + +
+
+
+ + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.0.0 + + Added file://. + + + + + + + + +
+ + + diff --git a/language/wrappers/ftp.xml b/language/wrappers/ftp.xml new file mode 100644 index 0000000000..9e425a24e4 --- /dev/null +++ b/language/wrappers/ftp.xml @@ -0,0 +1,187 @@ + + + + + + FTP and FTPS + Accessing FTP(s) URLs + + + + &reftitle.description; + + Allows read access to existing files and creation of new files + via FTP. If the server does not support passive mode ftp, the + connection will fail. + + + You can open files for either reading or writing, but not both + simultaneously. If the remote file already exists on the ftp + server and you attempt to open it for writing but have not specified + the context option overwrite, the connection + will fail. If you need to overwrite existing files over ftp, + specify the overwrite option in the context + and open the file for writing. Alternatively, you can + use the FTP extension. + + + If you have set the from directive + in &php.ini;, then this value will be sent as the anonymous FTP + password. + + + + + &reftitle.options; + + ftp://example.com/pub/file.txt + ftp://user:password@example.com/pub/file.txt + ftps://example.com/pub/file.txt + ftps://user:password@example.com/pub/file.txt + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + PHP 4 + PHP 5 + + + + + Restricted by allow_url_fopen + Yes + Yes + + + Allows Reading + Yes + Yes + + + Allows Writing + Yes (new files only) + Yes (new files/existing files with overwrite) + + + Allows Appending + No + Yes + + + Allows Simultaneous Reading and Writing + No + No + + + Supports stat + No + + As of PHP 5.0.0: filesize, + filetype, file_exists, + is_file, and is_dir elements only. + As of PHP 5.1.0: filemtime. + + + + Supports unlink + No + Yes + + + Supports rename + No + Yes + + + Supports mkdir + No + Yes + + + Supports rmdir + No + Yes + + + +
+
+
+ + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.0 + + Added ftps://. + + + + + + + + + + &reftitle.notes; + + + FTPS is only supported when the openssl + extension is enabled. + + + If the server does not support SSL, then the connection falls back + to regular unencrypted ftp. + + + + Appending + + As of PHP 5.0.0 files may be appended via the + ftp:// URL wrapper. In prior versions, attempting + to append to a file via ftp:// will result in failure. + + + + +
+ + + diff --git a/language/wrappers/glob.xml b/language/wrappers/glob.xml new file mode 100644 index 0000000000..fb9d9b9c18 --- /dev/null +++ b/language/wrappers/glob.xml @@ -0,0 +1,142 @@ + + + + + + Glob + Find pathnames matching pattern + + + + &reftitle.description; + + The glob: stream wrapper is available since PHP 5.3.0. + + + + + &reftitle.options; + + glob:// + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Restricted by allow_url_include + No + + + Allows Reading + No + + + Allows Writing + No + + + Allows Appending + No + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + No + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+
+ + + &reftitle.examples; + + Basic usage + +getFilename(), $f->getSize()/1024); +} +?> +]]> + + + + + + + +
+ + + diff --git a/language/wrappers/http.xml b/language/wrappers/http.xml new file mode 100644 index 0000000000..d8791be4ff --- /dev/null +++ b/language/wrappers/http.xml @@ -0,0 +1,236 @@ + + + + + + HTTP and HTTPS + Accessing HTTP(s) URLs + + + + &reftitle.description; + + Allows read-only access to files/resources via HTTP 1.0, + using the HTTP GET method. A Host: header is sent with the request + to handle name-based virtual hosts. If you have configured + a user_agent string using + your &php.ini; file or the stream context, it will also be included + in the request. + + + The stream allows access to the body of + the resource; the headers are stored in the + $http_response_header variable. + Since PHP 4.3.0, the headers are available using + stream_get_meta_data. + + &warn.ssl-non-standard; + + Redirects have been supported since PHP 4.0.5; if you are using + an earlier version you will need to include trailing slashes in + your URLs. If it's important to know the URL of the resource where + your document came from (after all redirects have been processed), + you'll need to process the series of response headers returned by the + stream. + + + If you have set the from directive + in &php.ini;, and do not define a From: header + in the , then this value will be sent as the + From: header in the HTTP request. + + + + + &reftitle.options; + + http://example.com + http://example.com/file.php?var1=val1&var2=val2 + http://user:password@example.com + https://example.com + https://example.com/file.php?var1=val1&var2=val2 + https://user:password@example.com + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + Yes + + + Allows Reading + Yes + + + Allows Writing + No + + + Allows Appending + No + + + Allows Simultaneous Reading and Writing + N/A + + + Supports stat + No + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+
+ + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.0 + + Added https://. + + + + + + + + + + &reftitle.examples; + + + +]]> + + + + + Sending custom headers with an HTTP request + + Custom headers may be sent with an HTTP request prior to + version 5 by taking advantage of a side-effect in the + handling of the user_agent INI setting. + Set user_agent to any valid string + (such as the default PHP/version setting) + followed by a carriage-return/line-feed pair and any + additional headers. + This method works in PHP 4 and all later versions. + + + +]]> + + Results in the following request being sent: + + + + + + + + &reftitle.notes; + + + HTTPS is only supported when the openssl + extension is enabled. + + + + HTTP connections are read-only; writing data or copying + files to an HTTP resource is not supported. + + + +
+ + + diff --git a/language/wrappers/phar.xml b/language/wrappers/phar.xml new file mode 100644 index 0000000000..48881177da --- /dev/null +++ b/language/wrappers/phar.xml @@ -0,0 +1,111 @@ + + + + + + phar:// + PHP Archive + + + + &reftitle.description; + + The phar:// stream wrapper is available since + PHP 5.3.0. See Phar stream wrapper + for detailed description. + + + + + &reftitle.options; + + phar:// + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Restricted by allow_url_include + No + + + Allows Reading + Yes + + + Allows Writing + Yes + + + Allows Appending + No + + + Allows Simultaneous Reading and Writing + Yes + + + Supports stat + Yes + + + Supports unlink + Yes + + + Supports rename + Yes + + + Supports mkdir + Yes + + + Supports rmdir + Yes + + + +
+
+
+ +
+ + + diff --git a/language/wrappers/php.xml b/language/wrappers/php.xml new file mode 100644 index 0000000000..72f83da536 --- /dev/null +++ b/language/wrappers/php.xml @@ -0,0 +1,315 @@ + + + + + + PHP input/output + Accessing various I/O streams + + + + &reftitle.description; + + php://stdin, php://stdout + and php://stderr allow direct access to + the corresponding input or output stream of the PHP process. The stream + references a duplicate file descriptor, so if you open + php://stdin and later close it, you close only your + copy of the descriptor-the actual stream referenced by + STDIN is unaffected. Note that PHP exhibited buggy + behavior in this regard until PHP 5.2.1. It is recommended that you simply + use the constants STDIN, STDOUT + and STDERR instead of manually opening streams using + these wrappers. + + + php://output allows you to write to the + output buffer mechanism in the same way as + print and echo. + + + php://input allows you to read raw data + from the request body. + In case of POST requests, it preferrable to + $HTTP_RAW_POST_DATA as it does not depend on + special &php.ini; directives. Moreover, for those cases where + $HTTP_RAW_POST_DATA is not populated by + default, it is a potentially less memory intensive alternative + to activating always_populate_raw_post_data. + php://input is not available with + enctype="multipart/form-data". + + + + A stream opened with php://input can only be read + once; the stream does not support seek operations. However, depending + on the SAPI implementation, it may be possible to open another + php://input stream and restart reading. This is + only possible if the request body data has been saved. Typically, this + is the case for POST requests, but not other request methods, such as + PUT or PROPFIND. + + + + php://stdin and + php://input are read-only, whereas + php://stdout, + php://stderr and + php://output are write-only. + + + + php://filter is a kind of meta-wrapper designed + to permit the application of filters to a stream at the time of + opening. This is useful with all-in-one file functions such as + readfile, file, and + file_get_contents where there is otherwise + no opportunity to apply a filter to the stream prior the contents + being read. + + + The php://filter target takes the following + 'parameters' as parts of its 'path'. + + + + + &reftitle.options; + + php://stdin + php://stdout + php://stderr + php://output + php://input + php://filter (available since PHP 5.0.0) + php://memory (available since PHP 5.1.0) + php://temp (available since PHP 5.1.0) + + + + + &reftitle.options; + + + + Wrapper Summary (For <literal>php://filter</literal>, + refer to summary of wrapper being filtered.) + + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Restricted by allow_url_include + + php://input, + php://stdin, + php://memory and + php://temp only. + + + + Allows Reading + + php://stdin, + php://input, + php://memory and + php://temp only. + + + + Allows Writing + + php://stdout, + php://stderr, + php://output, + php://memory and + php://temp only. + + + + Allows Appending + + php://stdout, + php://stderr, + php://output, + php://memory and + php://temp only. (Equivalent to writing) + + + + Allows Simultaneous Reading and Writing + + php://memory and + php://temp only. + + + + Supports stat + + php://memory and + php://temp only. + + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + Supports stream_select + + php://stdin, php://stdout, + php://stderr and php://temp. + + + + +
+
+
+ + + &reftitle.examples; + + /resource=<stream to be filtered> (<emphasis>required</emphasis>) + + This parameter must be located at + the end of your php://filter specification and + should point to the stream which you want filtered. + + + +]]> + + + + /read=<filter list to apply to read chain> (<emphasis>optional</emphasis>) + + This parameter takes one or more + filternames separated by the pipe character |. + + + +]]> + + + + /write=<filter list to apply to write chain> (<emphasis>optional</emphasis>) + + This parameter takes one or more + filternames separated by the pipe character |. + + + +]]> + + + + + /<filter list to apply to both chains> (optional) + Any filter lists which are not + prefixed specifically by read= or + write= will be applied to both the read and + write chains (as appropriate). + + + + The php://memory wrapper stores the data in the + memory. php://temp behaves similarly, but uses a + temporary file for storing the data when a certain memory limit is reached + (the default is 2 MB). + + + The php://temp wrapper takes the following + 'parameters' as parts of its 'path': + + + + /maxmemory:<number of bytes> (<emphasis>optional</emphasis>) + + This parameter allows changing the + default value for the memory limit (when the data is moved to a temporary + file). + + + +]]> + + + + +
+ + + diff --git a/language/wrappers/rar.xml b/language/wrappers/rar.xml new file mode 100644 index 0000000000..8ade58cf83 --- /dev/null +++ b/language/wrappers/rar.xml @@ -0,0 +1,300 @@ + + + + + + rar:// + RAR + + + + &reftitle.description; + + The wrapper takes the url encoded path to the RAR archive (relative or absolute), + an optional asterik (*), an optional number sign + (#) and an optional url encoded entry name, as stored in the + archive. Specifying an entry name requires the number sign; a leading forward + slash in the entry name is optional. + + + + This wrapper can open both files and directories. When opening directories, the + asterisk sign forces the directory entries names to be returned unencoded. If it's + not specified, they will be returned url encoded – the reason for this is to allow + the wrapper to be correctly used with built-in functionality like the + RecursiveDirectoryIterator in the presence of file names that seem like + url encoded data. + + + + If the pound sign and the entry name part are not included, the root of the archive + will be displayed. This differs from regular directories in that the resulting + stream will not contain information such as the modification time, as the root + directory is not stored in an inidivual entry in the archive. + The usage of the the wrapper with RecursiveDirectoryIterator requires + the number sign to be included in the URL when accessing the root, so that the + URLs of the children may be constructed correctly. + + + This wrapper is not enabled by default + + In order to use the rar:// wrapper, you must install + the rar extension + available from PECL. + + + + rar:// + Available since PECL rar 3.0.0 + + + + + + &reftitle.options; + + rar://<url encoded archive name>[*][#[<url encoded entry name>]] + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + Supported + + + + + Restricted by allow_url_fopen + No + + + Restricted by allow_url_include + No + + + Allows Reading + Yes + + + Allows Writing + No + + + Allows Appending + No + + + Allows Simultaneous Reading and Writing + No + + + Supports stat + Yes + + + Supports unlink + No + + + Supports rename + No + + + Supports mkdir + No + + + Supports rmdir + No + + + +
+
+ + + + + Context options + + + + Name + Usage + Default + + + + + open_password + The password used to encrypt the headers of the archive, + if any. WinRAR will encrypt all the files with the same password + as the headers password when the later is present, so for archives + with encrypted headers, file_password will be + ignored. + + + + + file_password + The password used to encrypt a file, if any. If the headers + are also encrypted, this option will be ignored in favor of + open_password. The reason there are two options + is to cover the possibility of supporting archives with different + headers and file passwords, should those archives arise. Note that + if the archive does not have its headers encrypted, + open_password will be ignored and this option + must be used instead. + + + + + volume_callback + A callback to determine the path of missing volumes. See + RarArchive::open for more information. + + + + + +
+
+
+ + + &reftitle.examples; + + Traversing a RAR archive + +getSubPathName()) . + (is_dir(parent::current())?" [DIR]":""); + } +} + +$f = "rar://" . rawurlencode(dirname(__FILE__)) . + DIRECTORY_SEPARATOR . 'dirs_and_extra_headers.rar#'; + +$it = new RecursiveTreeIterator(new MyRecDirIt($f)); + +foreach ($it as $s) { + echo $s, "\n"; +} +?> +]]> + + &example.outputs.similar; + + + + + + Opening an encrypted file (header encryption) + + + array( + 'open_password' => 'samplepassword' + ) + ) + ) + ); +var_dump(stream_get_contents($stream)); +/* creation and last access date is opt-in in WinRAR, hence most + * files don't have them */ +var_dump(fstat($stream)); +?> +]]> + + &example.outputs.similar; + + 0 + [1] => 0 + [2] => 33206 + [3] => 1 + [4] => 0 + [5] => 0 + [6] => 0 + [7] => 26 + [8] => 0 + [9] => 1259550052 + [10] => 0 + [11] => -1 + [12] => -1 + [dev] => 0 + [ino] => 0 + [mode] => 33206 + [nlink] => 1 + [uid] => 0 + [gid] => 0 + [rdev] => 0 + [size] => 26 + [atime] => 0 + [mtime] => 1259550052 + [ctime] => 0 + [blksize] => -1 + [blocks] => -1 +) +]]> + + + + +
+ + + diff --git a/language/wrappers/ssh2.xml b/language/wrappers/ssh2.xml new file mode 100644 index 0000000000..ed6b05bb59 --- /dev/null +++ b/language/wrappers/ssh2.xml @@ -0,0 +1,274 @@ + + + + + + ssh2:// + Secure Shell 2 + + + + &reftitle.description; + + ssh2.shell:// + ssh2.exec:// + ssh2.tunnel:// + ssh2.sftp:// + ssh2.scp:// + PHP 4.3.0 and up (PECL) + + + + This wrapper is not enabled by default + + In order to use the ssh2.*:// wrappers you must install + the SSH2 extension + available from PECL. + + + + + In addition to accepting traditional URI login details, the ssh2 wrappers + will also reuse open connections by passing the connection resource in the + host portion of the URL. + + + + + &reftitle.options; + + ssh2.shell://user:pass@example.com:22/xterm + ssh2.exec://user:pass@example.com:22/usr/local/bin/somecmd + ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14 + ssh2.sftp://user:pass@example.com:22/path/to/filename + + + + + &reftitle.options; + + + Wrapper Summary + + + + Attribute + ssh2.shell + ssh2.exec + ssh2.tunnel + ssh2.sftp + ssh2.scp + + + + + Restricted by allow_url_fopen + Yes + Yes + Yes + Yes + Yes + + + Allows Reading + Yes + Yes + Yes + Yes + Yes + + + Allows Writing + Yes + Yes + Yes + Yes + No + + + Allows Appending + No + No + No + Yes (When supported by server) + No + + + Allows Simultaneous Reading and Writing + Yes + Yes + Yes + Yes + No + + + Supports stat + No + No + No + Yes + No + + + Supports unlink + No + No + No + Yes + No + + + Supports rename + No + No + No + Yes + No + + + Supports mkdir + No + No + No + Yes + No + + + Supports rmdir + No + No + No + Yes + No + + + +
+
+ + + + + + Context options + + + + Name + Usage + Default + + + + + session + Preconnected ssh2 resource to be reused + + + + sftp + Preallocated sftp resource to be reused + + + + methods + Key exchange, hostkey, cipher, compression, and MAC methods to use + + + + callbacks + + + + + username + Username to connect as + + + + password + Password to use with password authentication + + + + pubkey_file + Name of public key file to use for authentication + + + + privkey_file + Name of private key file to use for authentication + + + + env + Associate array of environment variables to set + + + + term + Terminal emulation type to request when allocating a pty + + + + term_width + Width of terminal requested when allocating a pty + + + + term_height + Height of terminal requested when allocating a pty + + + + term_units + Units to use with term_width and term_height + SSH2_TERM_UNIT_CHARS + + + +
+
+
+ + + &reftitle.examples; + + Opening a stream from an active connection + + +]]> + + + + + +
+ + +