diff --git a/reference/stream/functions/stream-context-create.xml b/reference/stream/functions/stream-context-create.xml
index a8f00b7885..5df3079bce 100644
--- a/reference/stream/functions/stream-context-create.xml
+++ b/reference/stream/functions/stream-context-create.xml
@@ -1,48 +1,48 @@
-
-
-
- stream_context_create
- Create a streams context
-
-
- Description
-
- resourcestream_context_create
- arrayoptions
- arrayparams
-
-
- Creates and returns a stream context with any options supplied in
- options preset.
-
-
- options must be an associative
- array of associative arrays in the format
- $arr['wrapper']['option'] = $value.
- It defaults to an empty array.
-
-
- params must be an associative array
- in the format $arr['parameter'] = $value.
- Refer to stream_context_set_params for
- a listing of standard stream parameters.
-
-
-
- The params argument
- was added to PHP 6.0.0.
-
-
-
- Using stream_context_create
-
+
+
+
+ stream_context_create
+ Create a streams context
+
+
+ Description
+
+ resourcestream_context_create
+ arrayoptions
+ arrayparams
+
+
+ Creates and returns a stream context with any options supplied in
+ options preset.
+
+
+ options must be an associative
+ array of associative arrays in the format
+ $arr['wrapper']['option'] = $value.
+ It defaults to an empty array.
+
+
+ params must be an associative array
+ in the format $arr['parameter'] = $value.
+ Refer to stream_context_set_params for
+ a listing of standard stream parameters.
+
+
+
+ The params argument
+ was added to PHP 6.0.0.
+
+
+
+ Using stream_context_create
+
array(
'method'=>"GET",
- 'header'=>"Accept-language: en\r\n" .
+ 'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
@@ -56,15 +56,15 @@ fpassthru($fp);
fclose($fp);
?>
]]>
-
-
-
- See also
- stream_context_set_option, and
- Listing of supported wrappers with context options ().
-
-
-
+
+
+
+ See also
+ stream_context_set_option, and
+ Listing of supported wrappers with context options ().
+
+
+
-
-
- stream_context_get_default
- Retreive the default streams context
-
-
- Description
-
- resourcestream_context_get_default
- arrayoptions
-
-
- Returns the default stream context which is used whenever file operations
- (fopen, file_get_contents, etc...)
- are called without a context parameter. Options for the default context
- can optionally be specified with this function using the same syntax as
- stream_context_create.
-
-
- options must be an associative
- array of associative arrays in the format
- $arr['wrapper']['option'] = $value.
-
-
- Using stream_context_get_default
-
+
+
+
+ stream_context_get_default
+ Retreive the default streams context
+
+
+ Description
+
+ resourcestream_context_get_default
+ arrayoptions
+
+
+ Returns the default stream context which is used whenever file operations
+ (fopen, file_get_contents, etc...)
+ are called without a context parameter. Options for the default context
+ can optionally be specified with this function using the same syntax as
+ stream_context_create.
+
+
+ options must be an associative
+ array of associative arrays in the format
+ $arr['wrapper']['option'] = $value.
+
+
+ Using stream_context_get_default
+
array(
'method'=>"GET",
- 'header'=>"Accept-language: en\r\n" .
+ 'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar",
'proxy'=>"tcp://10.54.1.39:8000"
)
@@ -62,15 +62,15 @@ readfile('http://www.example.com', false, $alternate);
?>
]]>
-
-
-
- See also
- stream_context_create, and
- Listing of supported wrappers with context options ().
-
-
-
+
+
+
+ See also
+ stream_context_create, and
+ Listing of supported wrappers with context options ().
+
+
+
-
-
- stream_context_get_options
- Retrieve options for a stream/wrapper/context
-
-
- Description
-
- arraystream_context_get_options
- resourcestream_or_context
-
-
- Returns an array of options on the specified stream or context.
-
-
-
+
+
+
+ stream_context_get_options
+ Retrieve options for a stream/wrapper/context
+
+
+ Description
+
+ arraystream_context_get_options
+ resourcestream_or_context
+
+
+ Returns an array of options on the specified stream or context.
+
+
+
-
-
- stream_context_set_option
- Sets an option for a stream/wrapper/context
-
-
- Description
-
- boolstream_context_set_option
- resourcestream_or_context
- stringwrapper
- stringoption
- mixedvalue
-
-
- boolstream_context_set_option
- resourcestream_or_context
- arrayoptions
-
-
- Sets an option on the specified context. value
- is set to option for wrapper
-
-
-
+
+
+
+ stream_context_set_option
+ Sets an option for a stream/wrapper/context
+
+
+ Description
+
+ boolstream_context_set_option
+ resourcestream_or_context
+ stringwrapper
+ stringoption
+ mixedvalue
+
+
+ boolstream_context_set_option
+ resourcestream_or_context
+ arrayoptions
+
+
+ Sets an option on the specified context. value
+ is set to option for wrapper
+
+
+
-
-
- stream_context_set_params
- Set parameters for a stream/wrapper/context
-
-
- Description
-
- boolstream_context_set_params
- resourcestream_or_context
- arrayparams
-
-
- params should be an associative array of the structure:
- $params['paramname'] = "paramvalue";.
-
-
- Parameters
-
-
-
- Parameters
- Purpose
-
-
-
-
- notification
-
- Name of user-defined callback function to be called whenever a stream triggers a notification.
-
-
-
- options
-
- Array of options as in stream_context_create.
-
-
-
-
-
-
-
+
+
+
+ stream_context_set_params
+ Set parameters for a stream/wrapper/context
+
+
+ Description
+
+ boolstream_context_set_params
+ resourcestream_or_context
+ arrayparams
+
+
+ params should be an associative array of the structure:
+ $params['paramname'] = "paramvalue";.
+
+
+ Parameters
+
+
+
+ Parameters
+ Purpose
+
+
+
+
+ notification
+
+ Name of user-defined callback function to be called whenever a stream triggers a notification.
+
+
+
+ options
+
+ Array of options as in stream_context_create.
+
+
+
+
+
+
+
-
-
- stream_filter_append
- Attach a filter to a stream
-
-
- Description
-
- resourcestream_filter_append
- resourcestream
- stringfiltername
- intread_write
- mixedparams
-
-
- Adds filtername to the list of filters
- attached to stream. This filter will be
- added with the specified params
- to the end of the list and
- will therefore be called last during stream operations. To
- add a filter to the beginning of the list, use
- stream_filter_prepend.
-
-
- By default, stream_filter_append will
- attach the filter to the read filter chain
- if the file was opened for reading (i.e. File Mode:
- r, and/or +). The filter
- will also be attached to the write filter chain
- if the file was opened for writing (i.e. File Mode:
- w, a, and/or +).
- STREAM_FILTER_READ,
- STREAM_FILTER_WRITE, and/or
- STREAM_FILTER_ALL can also be passed to the
- read_write parameter to override this behavior.
-
-
- As of PHP 5.1.0, this function returns a resource which
- can be used to refer to this filter instance during a call
- to stream_filter_remove.
- Prior to PHP 5.1.0, this function returns &true; on success
- or &false; on failure.
-
-
-
- Controlling where filters are applied
-
+
+
+
+ stream_filter_append
+ Attach a filter to a stream
+
+
+ Description
+
+ resourcestream_filter_append
+ resourcestream
+ stringfiltername
+ intread_write
+ mixedparams
+
+
+ Adds filtername to the list of filters
+ attached to stream. This filter will be
+ added with the specified params
+ to the end of the list and
+ will therefore be called last during stream operations. To
+ add a filter to the beginning of the list, use
+ stream_filter_prepend.
+
+
+ By default, stream_filter_append will
+ attach the filter to the read filter chain
+ if the file was opened for reading (i.e. File Mode:
+ r, and/or +). The filter
+ will also be attached to the write filter chain
+ if the file was opened for writing (i.e. File Mode:
+ w, a, and/or +).
+ STREAM_FILTER_READ,
+ STREAM_FILTER_WRITE, and/or
+ STREAM_FILTER_ALL can also be passed to the
+ read_write parameter to override this behavior.
+
+
+ As of PHP 5.1.0, this function returns a resource which
+ can be used to refer to this filter instance during a call
+ to stream_filter_remove.
+ Prior to PHP 5.1.0, this function returns &true; on success
+ or &false; on failure.
+
+
+
+ Controlling where filters are applied
+
]]>
-
-
-
-
- When using custom (user) filters
-
- stream_filter_register must be called first
- in order to register the desired user filter to filtername.
-
-
-
-
- Stream data is read from resources (both local and remote) in chunks,
- with any unconsumed data kept in internal buffers. When a new
- filter is appended to a stream, data in the internal buffers is processed through
- the new filter at that time. This differs from the behavior of
- stream_filter_prepend.
-
-
-
- See also
- stream_filter_register,
- stream_filter_prepend, and
- stream_get_filters.
-
-
-
+
+
+
+
+ When using custom (user) filters
+
+ stream_filter_register must be called first
+ in order to register the desired user filter to filtername.
+
+
+
+
+ Stream data is read from resources (both local and remote) in chunks,
+ with any unconsumed data kept in internal buffers. When a new
+ filter is appended to a stream, data in the internal buffers is processed through
+ the new filter at that time. This differs from the behavior of
+ stream_filter_prepend.
+
+
+
+ See also
+ stream_filter_register,
+ stream_filter_prepend, and
+ stream_get_filters.
+
+
+
-
-
- stream_filter_prepend
- Attach a filter to a stream
-
-
- Description
-
- resourcestream_filter_prepend
- resourcestream
- stringfiltername
- intread_write
- mixedparams
-
-
- Adds filtername to the list of filters
- attached to stream. This filter will be
- added with the specified params
- to the beginning of the list and
- will therefore be called first during stream operations. To
- add a filter to the end of the list, use
- stream_filter_append.
-
-
- By default, stream_filter_prepend will
- attach the filter to the read filter chain
- if the file was opened for reading (i.e. File Mode:
- r, and/or +). The filter
- will also be attached to the write filter chain
- if the file was opened for writing (i.e. File Mode:
- w, a, and/or +).
- STREAM_FILTER_READ,
- STREAM_FILTER_WRITE, and/or
- STREAM_FILTER_ALL can also be passed to the
- read_write parameter to override this behavior.
- See stream_filter_append for an example of
- using this parameter.
-
-
- As of PHP 5.1.0, this function returns a resource which
- can be used to refer to this filter instance during a call
- to stream_filter_remove.
- Prior to PHP 5.1.0, this function returns &true; on success
- or &false; on failure.
-
-
- When using custom (user) filters
-
- stream_filter_register must be called first
- in order to register the desired user filter to filtername.
-
-
-
-
- Stream data is read from resources (both local and remote) in chunks,
- with any unconsumed data kept in internal buffers. When a new
- filter is prepended to a stream, data in the internal buffers,
- which has already been processed through other filters will
- not be reprocessed through the new filter
- at that time. This differs from the behavior of
- stream_filter_append.
-
-
-
- See also
- stream_filter_register, and
- stream_filter_append.
-
-
-
+
+
+
+ stream_filter_prepend
+ Attach a filter to a stream
+
+
+ Description
+
+ resourcestream_filter_prepend
+ resourcestream
+ stringfiltername
+ intread_write
+ mixedparams
+
+
+ Adds filtername to the list of filters
+ attached to stream. This filter will be
+ added with the specified params
+ to the beginning of the list and
+ will therefore be called first during stream operations. To
+ add a filter to the end of the list, use
+ stream_filter_append.
+
+
+ By default, stream_filter_prepend will
+ attach the filter to the read filter chain
+ if the file was opened for reading (i.e. File Mode:
+ r, and/or +). The filter
+ will also be attached to the write filter chain
+ if the file was opened for writing (i.e. File Mode:
+ w, a, and/or +).
+ STREAM_FILTER_READ,
+ STREAM_FILTER_WRITE, and/or
+ STREAM_FILTER_ALL can also be passed to the
+ read_write parameter to override this behavior.
+ See stream_filter_append for an example of
+ using this parameter.
+
+
+ As of PHP 5.1.0, this function returns a resource which
+ can be used to refer to this filter instance during a call
+ to stream_filter_remove.
+ Prior to PHP 5.1.0, this function returns &true; on success
+ or &false; on failure.
+
+
+ When using custom (user) filters
+
+ stream_filter_register must be called first
+ in order to register the desired user filter to filtername.
+
+
+
+
+ Stream data is read from resources (both local and remote) in chunks,
+ with any unconsumed data kept in internal buffers. When a new
+ filter is prepended to a stream, data in the internal buffers,
+ which has already been processed through other filters will
+ not be reprocessed through the new filter
+ at that time. This differs from the behavior of
+ stream_filter_append.
+
+
+
+ See also
+ stream_filter_register, and
+ stream_filter_append.
+
+
+
-
-
- stream_filter_register
-
- Register a stream filter implemented as a PHP class
- derived from php_user_filter
-
-
-
- Description
-
- boolstream_filter_register
- stringfiltername
- stringclassname
-
-
- stream_filter_register allows you to implement
- your own filter on any registered stream used with all the other
- filesystem functions (such as fopen,
- fread etc.).
-
-
- To implement a filter, you need to define a class as an extension of
- php_user_filter with a number of member functions
- as defined below. When performing read/write operations on the stream
- to which your filter is attached, PHP will pass the data through your
- filter (and any other filters attached to that stream) so that the
- data may be modified as desired. You must implement the methods
- exactly as described below - doing otherwise will lead to undefined
- behaviour.
-
-
- stream_filter_register will return &false; if the
- filtername is already defined.
-
+
+
+
+ stream_filter_register
+ Register a stream filter implemented as a PHP class derived from php_user_filter
+
+
+ Description
+
+ boolstream_filter_register
+ stringfiltername
+ stringclassname
+
+
+ stream_filter_register allows you to implement
+ your own filter on any registered stream used with all the other
+ filesystem functions (such as fopen,
+ fread etc.).
+
+
+ To implement a filter, you need to define a class as an extension of
+ php_user_filter with a number of member functions
+ as defined below. When performing read/write operations on the stream
+ to which your filter is attached, PHP will pass the data through your
+ filter (and any other filters attached to that stream) so that the
+ data may be modified as desired. You must implement the methods
+ exactly as described below - doing otherwise will lead to undefined
+ behaviour.
+
+
+ stream_filter_register will return &false; if the
+ filtername is already defined.
+
-
- intfilter
- resourcein
- resourceout
- intconsumed
- boolclosing
-
-
- This method is called whenever data is read from or written to
- the attached stream (such as with fread or fwrite).
- in is a resource pointing to a bucket brigade
- which contains one or more bucket objects containing data to be filtered.
- out is a resource pointing to a second bucket brigade
- into which your modified buckets should be placed.
- consumed, which must always
- be declared by reference, should be incremented by the length of the data
- which your filter reads in and alters. In most cases this means you will
- increment consumed by $bucket->datalen for each $bucket.
- If the stream is in the process of closing (and therefore this is the last pass
- through the filterchain), the closing parameter will be
- set to &true; The filter method must return one of
- three values upon completion.
+
+ intfilter
+ resourcein
+ resourceout
+ intconsumed
+ boolclosing
+
+
+ This method is called whenever data is read from or written to
+ the attached stream (such as with fread or fwrite).
+ in is a resource pointing to a bucket brigade
+ which contains one or more bucket objects containing data to be filtered.
+ out is a resource pointing to a second bucket brigade
+ into which your modified buckets should be placed.
+ consumed, which must always
+ be declared by reference, should be incremented by the length of the data
+ which your filter reads in and alters. In most cases this means you will
+ increment consumed by $bucket->datalen for each $bucket.
+ If the stream is in the process of closing (and therefore this is the last pass
+ through the filterchain), the closing parameter will be
+ set to &true; The filter method must return one of
+ three values upon completion.
-
-
-
-
- Return Value
- Meaning
-
-
-
-
- PSFS_PASS_ON
-
- Filter processed successfully with data available in the
- outbucket brigade.
-
-
-
- PSFS_FEED_ME
-
- Filter processed successfully, however no data was available to
- return. More data is required from the stream or prior filter.
-
-
-
- PSFS_ERR_FATAL (default)
-
- The filter experienced an unrecoverable error and cannot continue.
-
-
-
-
-
-
+
+
+
+
+ Return Value
+ Meaning
+
+
+
+
+ PSFS_PASS_ON
+
+ Filter processed successfully with data available in the
+ outbucket brigade.
+
+
+
+ PSFS_FEED_ME
+
+ Filter processed successfully, however no data was available to
+ return. More data is required from the stream or prior filter.
+
+
+
+ PSFS_ERR_FATAL (default)
+
+ The filter experienced an unrecoverable error and cannot continue.
+
+
+
+
+
+
-
- boolonCreate
-
-
-
- This method is called during instantiation of the filter class
- object. If your filter allocates or initializes any other resources
- (such as a buffer), this is the place to do it. Your implementation of
- this method should return &false; on failure, or &true; on success.
-
-
- When your filter is first instantiated, and
- yourfilter->onCreate() is called, a number of properties
- will be available as shown in the table below.
-
-
-
-
-
-
- Property
- Contents
-
-
-
-
- FilterClass->filtername
- A string containing the name the filter was instantiated with.
- Filters may be registered under multiple names or under wildcards.
- Use this property to determine which name was used.
-
-
- FilterClass->params
- The contents of the params parameter passed
- to stream_filter_append
- or stream_filter_prepend.
-
-
-
-
-
+
+ boolonCreate
+
+
+
+ This method is called during instantiation of the filter class
+ object. If your filter allocates or initializes any other resources
+ (such as a buffer), this is the place to do it. Your implementation of
+ this method should return &false; on failure, or &true; on success.
+
+
+ When your filter is first instantiated, and
+ yourfilter->onCreate() is called, a number of properties
+ will be available as shown in the table below.
+
+
+
+
+
+
+ Property
+ Contents
+
+
+
+
+ FilterClass->filtername
+ A string containing the name the filter was instantiated with.
+ Filters may be registered under multiple names or under wildcards.
+ Use this property to determine which name was used.
+
+
+ FilterClass->params
+ The contents of the params parameter passed
+ to stream_filter_append
+ or stream_filter_prepend.
+
+
+
+
+
-
- voidonClose
-
-
-
- This method is called upon filter shutdown (typically, this is also
- during stream shutdown), and is executed after
- the flush method is called. If any resources
- were allocated or initialzed during onCreate
- this would be the time to destroy or dispose of them.
-
+
+ voidonClose
+
+
+
+ This method is called upon filter shutdown (typically, this is also
+ during stream shutdown), and is executed after
+ the flush method is called. If any resources
+ were allocated or initialzed during onCreate
+ this would be the time to destroy or dispose of them.
+
-
- The example below implements a filter named strtoupper
- on the foo-bar.txt stream which will capitalize
- all letter characters written to/read from that stream.
+
+ The example below implements a filter named strtoupper
+ on the foo-bar.txt stream which will capitalize
+ all letter characters written to/read from that stream.
-
- Filter for capitalizing characters on foo-bar.txt stream
-
+
+ Filter for capitalizing characters on foo-bar.txt stream
+
data = strtoupper($bucket->data);
@@ -169,7 +166,7 @@ class strtoupper_filter extends php_user_filter {
}
return PSFS_PASS_ON;
}
-}
+}
/* Register our filter with PHP */
stream_filter_register("strtoupper", "strtoupper_filter")
@@ -192,21 +189,21 @@ readfile("foo-bar.txt");
?>
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
-
-
- Registering a generic filter class to match multiple filter names.
-
+
+
+
+
+
+ Registering a generic filter class to match multiple filter names.
+
mode == 1) {
@@ -229,7 +226,7 @@ class string_filter extends php_user_filter {
return PSFS_PASS_ON;
}
- function onCreate()
+ function onCreate()
{
if ($this->filtername == 'str.toupper') {
$this->mode = 1;
@@ -243,7 +240,7 @@ class string_filter extends php_user_filter {
return true;
}
-}
+}
/* Register our filter with PHP */
stream_filter_register("str.*", "string_filter")
@@ -251,7 +248,7 @@ stream_filter_register("str.*", "string_filter")
$fp = fopen("foo-bar.txt", "w");
-/* Attach the registered filter to the stream just opened
+/* Attach the registered filter to the stream just opened
We could alternately bind to str.tolower here */
stream_filter_append($fp, "str.toupper");
@@ -266,26 +263,26 @@ fclose($fp);
readfile("foo-bar.txt");
?>
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
-
-
-
+
+
+
-
- See also
- stream_wrapper_register,
- stream_filter_prepend, and
- stream_filter_append.
-
-
-
+
+ See also
+ stream_wrapper_register,
+ stream_filter_prepend, and
+ stream_filter_append.
+
+
+
-
-
- stream_filter_remove
- Remove a filter from a stream
-
-
- Description
-
- boolstream_filter_remove
- resourcestream_filter
-
-
- Removes a stream filter previously added to a stream
- with stream_filter_prepend or
- stream_filter_append. Any data
- remaining in the filter's internal buffer will be flushed
- through to the next filter before removing it.
-
-
-
- Dynamicly refiltering a stream
-
+
+
+
+ stream_filter_remove
+ Remove a filter from a stream
+
+
+ Description
+
+ boolstream_filter_remove
+ resourcestream_filter
+
+
+ Removes a stream filter previously added to a stream
+ with stream_filter_prepend or
+ stream_filter_append. Any data
+ remaining in the filter's internal buffer will be flushed
+ through to the next filter before removing it.
+
+
+
+ Dynamicly refiltering a stream
+
]]>
-
-
-
-
- See also
- stream_filter_register,
- stream_filter_append, and
- stream_filter_prepend.
-
-
-
+
+
+
+
+ See also
+ stream_filter_register,
+ stream_filter_append, and
+ stream_filter_prepend.
+
+
+
-
-
- stream_get_contents
- Reads remainder of a stream into a string
-
-
- Description
-
- stringstream_get_contents
- resourcehandle
- intmaxlength
- intoffset
-
-
- Identical to file_get_contents, except that
- stream_get_contents operates on an already open
- stream resource and returns the remaining contents in a string, up to
- maxlength bytes and starting at the specified
- offset.
-
-
+
+
+
+ stream_get_contents
+ Reads remainder of a stream into a string
+
+
+ Description
+
+ stringstream_get_contents
+ resourcehandle
+ intmaxlength
+ intoffset
+
+
+ Identical to file_get_contents, except that
+ stream_get_contents operates on an already open
+ stream resource and returns the remaining contents in a string, up to
+ maxlength bytes and starting at the specified
+ offset.
+
+
-
- &reftitle.parameters;
-
-
-
- handle (resource)
-
-
- A stream resource (e.g. returned from fopen)
-
-
-
-
- maxlength (integer)
-
-
- The maximum bytes to read. Defaults to -1 (read all the remaining
- buffer).
-
-
-
-
- offset (integer)
-
-
- Seek to the specified offset before reading. Added in PHP 5.1.0.
-
-
-
-
-
-
+
+ &reftitle.parameters;
+
+
+
+ handle (resource)
+
+
+ A stream resource (e.g. returned from fopen)
+
+
+
+
+ maxlength (integer)
+
+
+ The maximum bytes to read. Defaults to -1 (read all the remaining
+ buffer).
+
+
+
+
+ offset (integer)
+
+
+ Seek to the specified offset before reading. Added in PHP 5.1.0.
+
+
+
+
+
+
-
- &reftitle.returnvalues;
-
- Returns a string, or &false; on failure.
-
-
+
+ &reftitle.returnvalues;
+
+ Returns a string, or &false; on failure.
+
+
-
- &reftitle.examples;
-
+
+ &reftitle.examples;
+ stream_get_contents example
@@ -88,23 +88,23 @@ if ($stream = fopen('http://www.example.net', 'r')) {
?>
]]>
-
-
-
-
+
+
+
+
-
- &reftitle.seealso;
-
-
- fgets
- fread
- fpassthru
-
-
- ¬e.bin-safe;
-
-
+
+ &reftitle.seealso;
+
+
+ fgets
+ fread
+ fpassthru
+
+
+ ¬e.bin-safe;
+
+
-
-
- stream_get_filters
- Retrieve list of registered filters
-
-
- Description
-
- arraystream_get_filters
-
-
-
- Returns an indexed array containing the name of all stream filters
- available on the running system.
-
-
-
- Using stream_get_filters
-
+
+
+
+ stream_get_filters
+ Retrieve list of registered filters
+
+
+ Description
+
+ arraystream_get_filters
+
+
+
+ Returns an indexed array containing the name of all stream filters
+ available on the running system.
+
+
+
+ Using stream_get_filters
+
]]>
-
-
- Output will be similar to the following.
- Note: there may be more or fewer filters in your version of PHP.
-
-
+
+
+ Output will be similar to the following.
+ Note: there may be more or fewer filters in your version of PHP.
+
+
string.rot13
@@ -40,16 +40,16 @@ Array (
[4] => string.quoted-printable
)
]]>
-
-
-
-
- See also
- stream_filter_register, and
- stream_get_wrappers.
-
-
-
+
+
+
+
+ See also
+ stream_filter_register, and
+ stream_get_wrappers.
+
+
+
-
-
- stream_get_line
- Gets line from stream resource up to a given delimiter
-
-
- Description
-
- stringstream_get_line
- resourcehandle
- intlength
- stringending
-
-
- Returns a string of up to length bytes read from the file
- pointed to by handle. Reading ends when
- length bytes have been read, when the string specified by
- ending is found (which is not included
- in the return value), or on EOF (whichever comes first).
-
-
- If an error occurs, returns &false;.
-
-
- This function is nearly identical to fgets
- except in that it allows end of line delimiters other than the
- standard \n, \r, and \r\n, and does not
- return the delimiter itself.
-
-
- See also fread,
- fgets, and
- fgetc.
-
-
-
+
+
+
+ stream_get_line
+ Gets line from stream resource up to a given delimiter
+
+
+ Description
+
+ stringstream_get_line
+ resourcehandle
+ intlength
+ stringending
+
+
+ Returns a string of up to length bytes read from the file
+ pointed to by handle. Reading ends when
+ length bytes have been read, when the string specified by
+ ending is found (which is not included
+ in the return value), or on EOF (whichever comes first).
+
+
+ If an error occurs, returns &false;.
+
+
+ This function is nearly identical to fgets
+ except in that it allows end of line delimiters other than the
+ standard \n, \r, and \r\n, and does not
+ return the delimiter itself.
+
+
+ See also fread,
+ fgets, and
+ fgetc.
+
+
+
-
-
- stream_get_meta_data
- Retrieves header/meta data from streams/file pointers
-
-
- Description
-
- arraystream_get_meta_data
- resourcestream
-
-
- Returns information about an existing stream.
- The stream can be any stream created by fopen,
- fsockopen and pfsockopen.
- The result array contains the following items:
-
-
-
-
- timed_out (bool) - &true; if the stream
- timed out while waiting for data on the last call to
- fread or fgets.
-
-
-
-
- blocked (bool) - &true; if the stream is
- in blocking IO mode. See stream_set_blocking.
-
-
-
-
- eof (bool) - &true; if the stream has reached
- end-of-file. Note that for socket streams this member can be &true;
- even when unread_bytes is non-zero. To
- determine if there is more data to be read, use
- feof instead of reading this item.
-
-
-
-
- unread_bytes (int) - the number of bytes
- currently contained in the PHP's own internal buffer.
-
-
-
- You shouldn't use this value in a script.
-
-
-
-
-
- The following items were added in PHP 4.3.0:
-
-
-
-
- stream_type (string) - a label describing
- the underlying implementation of the stream.
-
-
-
-
- wrapper_type (string) - a label describing
- the protocol wrapper implementation layered over the stream.
- See for more information about wrappers.
-
-
-
-
- wrapper_data (mixed) - wrapper specific
- data attached to this stream. See for
- more information about wrappers and their wrapper data.
-
-
-
-
- filters (array) - and array containing
- the names of any filters that have been stacked onto this stream.
- Documentation on filters can be found in the
- Filters appendix.
-
-
-
+
+
+
+ stream_get_meta_data
+ Retrieves header/meta data from streams/file pointers
+
+
+ Description
+
+ arraystream_get_meta_data
+ resourcestream
+
+
+ Returns information about an existing stream.
+ The stream can be any stream created by fopen,
+ fsockopen and pfsockopen.
+ The result array contains the following items:
+
+
+
+
+ timed_out (bool) - &true; if the stream
+ timed out while waiting for data on the last call to
+ fread or fgets.
+
+
+
+
+ blocked (bool) - &true; if the stream is
+ in blocking IO mode. See stream_set_blocking.
+
+
+
+
+ eof (bool) - &true; if the stream has reached
+ end-of-file. Note that for socket streams this member can be &true;
+ even when unread_bytes is non-zero. To
+ determine if there is more data to be read, use
+ feof instead of reading this item.
+
+
+
+
+ unread_bytes (int) - the number of bytes
+ currently contained in the PHP's own internal buffer.
+
-
- This function was introduced in PHP 4.3.0, but prior to this version,
- socket_get_status could be used to retrieve
- the first four items, for socket based streams only.
-
-
- In PHP 4.3.0 and later,
- socket_get_status is an alias for this function.
-
-
-
- This function does NOT work on sockets created by the Socket extension.
+
+ You shouldn't use this value in a script.
-
- The following items were added in PHP 5.0.0:
-
-
-
-
- mode (string) - the type of access required for
- this stream (see Table 1 of the fopen() reference)
-
-
-
-
- seekable (bool) - whether the current stream can
- be seeked.
-
-
-
-
- uri (string) - the URI/filename associated with this
- stream.
-
-
-
-
-
+
+
+
+ The following items were added in PHP 4.3.0:
+
+
+
+
+ stream_type (string) - a label describing
+ the underlying implementation of the stream.
+
+
+
+
+ wrapper_type (string) - a label describing
+ the protocol wrapper implementation layered over the stream.
+ See for more information about wrappers.
+
+
+
+
+ wrapper_data (mixed) - wrapper specific
+ data attached to this stream. See for
+ more information about wrappers and their wrapper data.
+
+
+
+
+ filters (array) - and array containing
+ the names of any filters that have been stacked onto this stream.
+ Documentation on filters can be found in the
+ Filters appendix.
+
+
+
+
+
+ This function was introduced in PHP 4.3.0, but prior to this version,
+ socket_get_status could be used to retrieve
+ the first four items, for socket based streams only.
+
+
+ In PHP 4.3.0 and later,
+ socket_get_status is an alias for this function.
+
+
+
+ This function does NOT work on sockets created by the Socket extension.
+
+
+
+ The following items were added in PHP 5.0.0:
+
+
+
+
+ mode (string) - the type of access required for
+ this stream (see Table 1 of the fopen() reference)
+
+
+
+
+ seekable (bool) - whether the current stream can
+ be seeked.
+
+
+
+
+ uri (string) - the URI/filename associated with this
+ stream.
+
+
+
+
+
-
-
- stream_get_transports
- Retrieve list of registered socket transports
-
-
- Description
-
- arraystream_get_transports
-
-
-
- Returns an indexed array containing the name of all socket transports
- available on the running system.
-
-
-
- Using stream_get_transports
-
+
+
+
+ stream_get_transports
+ Retrieve list of registered socket transports
+
+
+ Description
+
+ arraystream_get_transports
+
+
+
+ Returns an indexed array containing the name of all socket transports
+ available on the running system.
+
+
+
+ Using stream_get_transports
+
]]>
-
-
- Output will be similar to the following.
- Note: there may be more or fewer transports in your version of PHP.
-
-
+
+
+ Output will be similar to the following.
+ Note: there may be more or fewer transports in your version of PHP.
+
+
tcp
@@ -39,16 +39,16 @@ Array (
[3] => udg
)
]]>
-
-
-
-
- See also
- stream_get_filters, and
- stream_get_wrappers.
-
-
-
+
+
+
+
+ See also
+ stream_get_filters, and
+ stream_get_wrappers.
+
+
+
-
-
- stream_get_wrappers
- Retrieve list of registered streams
-
-
- Description
-
- arraystream_get_wrappers
-
-
-
- Returns an indexed array containing the name of all stream wrappers
- available on the running system.
-
-
-
- stream_get_wrappers example
-
+
+
+
+ stream_get_wrappers
+ Retrieve list of registered streams
+
+
+ Description
+
+ arraystream_get_wrappers
+
+
+
+ Returns an indexed array containing the name of all stream wrappers
+ available on the running system.
+
+
+
+ stream_get_wrappers example
+
]]>
-
- &example.outputs.similar;
-
+
+ &example.outputs.similar;
+
compress.zlib
)
]]>
-
-
-
-
-
- Checking for the existence of a stream wrapper
-
+
+
+
+
+
+ Checking for the existence of a stream wrapper
+
]]>
-
-
-
-
- See also
- stream_wrapper_register.
-
-
-
+
+
+
+
+ See also
+ stream_wrapper_register.
+
+
+
-
-
- stream_register_wrapper
- Alias of stream_wrapper_register
-
-
- Description
-
- This function is an alias of stream_wrapper_register.
- This function is included for compatability with PHP 4.3.0 and PHP 4.3.1
- only. stream_wrapper_register should be used instead.
-
-
-
+
+
+
+ stream_register_wrapper
+ Alias of stream_wrapper_register
+
+
+ Description
+
+ This function is an alias of stream_wrapper_register.
+ This function is included for compatability with PHP 4.3.0 and PHP 4.3.1
+ only. stream_wrapper_register should be used instead.
+
+
+
-
-
- stream_select
- Runs the equivalent of the select() system call on the given
- arrays of streams with a timeout specified by tv_sec and tv_usec
-
-
- Description
-
- intstream_select
- arrayread
- arraywrite
- arrayexcept
- inttv_sec
- inttv_usec
-
-
- The stream_select function accepts arrays of streams and
- waits for them to change status. Its operation is equivalent to that of
- the socket_select function except in that it acts on streams.
-
-
- The streams listed in the read array will be watched to
- see if characters become available for reading (more precisely, to see if
- a read will not block - in particular, a stream resource is also ready on
- end-of-file, in which case an fread will return
- a zero length string).
-
-
- The streams listed in the write array will be
- watched to see if a write will not block.
-
-
- The streams listed in the except array will be
- watched for high priority exceptional ("out-of-band") data arriving.
-
-
-
- When stream_select returns, the arrays
- read, write and
- except are modified to indicate which stream
- resource(s) actually changed status.
-
-
-
- The tv_sec and tv_usec
- together form the timeout parameter,
- tv_sec specifies the number of seconds while
- tv_usec the number of microseconds.
- The timeout is an upper bound on the amount of time
- that stream_select will wait before it returns.
- If tv_sec and tv_usec are
- both set to 0, stream_select will
- not wait for data - instead it will return immediately, indicating the
- current status of the streams.
- If tv_sec is &null; stream_select
- can block indefinitely, returning only when an event on one of the
- watched streams occurs (or if a signal interrupts the system call).
-
-
- On success stream_select returns the number of
- stream resources contained in the modified arrays, which may be zero if
- the timeout expires before anything interesting happens. On error &false;
- is returned and a warning raised (this can happen if the system call is
- interrupted by an incoming signal).
-
+
+
+
+ stream_select
+ Runs the equivalent of the select() system call on the given
+ arrays of streams with a timeout specified by tv_sec and tv_usec
+
+
+ Description
+
+ intstream_select
+ arrayread
+ arraywrite
+ arrayexcept
+ inttv_sec
+ inttv_usec
+
+
+ The stream_select function accepts arrays of streams and
+ waits for them to change status. Its operation is equivalent to that of
+ the socket_select function except in that it acts on streams.
+
+
+ The streams listed in the read array will be watched to
+ see if characters become available for reading (more precisely, to see if
+ a read will not block - in particular, a stream resource is also ready on
+ end-of-file, in which case an fread will return
+ a zero length string).
+
+
+ The streams listed in the write array will be
+ watched to see if a write will not block.
+
+
+ The streams listed in the except array will be
+ watched for high priority exceptional ("out-of-band") data arriving.
+
+
+
+ When stream_select returns, the arrays
+ read, write and
+ except are modified to indicate which stream
+ resource(s) actually changed status.
+
+
+
+ The tv_sec and tv_usec
+ together form the timeout parameter,
+ tv_sec specifies the number of seconds while
+ tv_usec the number of microseconds.
+ The timeout is an upper bound on the amount of time
+ that stream_select will wait before it returns.
+ If tv_sec and tv_usec are
+ both set to 0, stream_select will
+ not wait for data - instead it will return immediately, indicating the
+ current status of the streams.
+ If tv_sec is &null; stream_select
+ can block indefinitely, returning only when an event on one of the
+ watched streams occurs (or if a signal interrupts the system call).
+
+
+ On success stream_select returns the number of
+ stream resources contained in the modified arrays, which may be zero if
+ the timeout expires before anything interesting happens. On error &false;
+ is returned and a warning raised (this can happen if the system call is
+ interrupted by an incoming signal).
+
-
-
- Using a timeout value of 0 allows you to
- instantaneously poll the status of the streams, however, it is NOT a
- good idea to use a 0 timeout value in a loop as it
- will cause your script to consume too much CPU time.
-
-
- It is much better to specify a timeout value of a few seconds, although
- if you need to be checking and running other code concurrently, using a
- timeout value of at least 200000 microseconds will
- help reduce the CPU usage of your script.
-
-
- Remember that the timeout value is the
- maximum time that will elapse; stream_select will
- return as soon as the requested streams are ready for use.
-
-
-
- You do not need to pass every array to
- stream_select. You can leave it out and use an
- empty array or &null; instead. Also do not forget that those arrays are
- passed by reference and will be modified after
- stream_select returns.
-
-
- This example checks to see if data has arrived for reading on either
- $stream1 or $stream2.
- Since the timeout value is 0 it will return
- immediately:
-
+
+
+ Using a timeout value of 0 allows you to
+ instantaneously poll the status of the streams, however, it is NOT a
+ good idea to use a 0 timeout value in a loop as it
+ will cause your script to consume too much CPU time.
+
+
+ It is much better to specify a timeout value of a few seconds, although
+ if you need to be checking and running other code concurrently, using a
+ timeout value of at least 200000 microseconds will
+ help reduce the CPU usage of your script.
+
+
+ Remember that the timeout value is the
+ maximum time that will elapse; stream_select will
+ return as soon as the requested streams are ready for use.
+
+
+
+ You do not need to pass every array to
+ stream_select. You can leave it out and use an
+ empty array or &null; instead. Also do not forget that those arrays are
+ passed by reference and will be modified after
+ stream_select returns.
+
+
+ This example checks to see if data has arrived for reading on either
+ $stream1 or $stream2.
+ Since the timeout value is 0 it will return
+ immediately:
+
]]>
-
-
-
-
- Due to a limitation in the current Zend Engine it is not possible to pass a
- constant modifier like &null; directly as a parameter to a function
- which expects this parameter to be passed by reference. Instead use a
- temporary variable or an expression with the leftmost member being a
- temporary variable:
-
+
+
+
+
+ Due to a limitation in the current Zend Engine it is not possible to pass a
+ constant modifier like &null; directly as a parameter to a function
+ which expects this parameter to be passed by reference. Instead use a
+ temporary variable or an expression with the leftmost member being a
+ temporary variable:
+
]]>
-
-
-
-
-
- Be sure to use the === operator when checking for an
- error. Since the stream_select may return 0 the
- comparison with == would evaluate to &true;:
-
+
+
+
+
+
+ Be sure to use the === operator when checking for an
+ error. Since the stream_select may return 0 the
+ comparison with == would evaluate to &true;:
+
]]>
-
-
-
-
-
- If you read/write to a stream returned in the arrays be aware that
- they do not necessarily read/write the full amount of data you have
- requested. Be prepared to even only be able to read/write a single
- byte.
-
-
-
-
- Windows compatibility: stream_select used on a
- pipe returned from proc_open may cause data loss
- under Windows 98.
-
-
- Use of stream_select on
- file descriptors returned by proc_open will fail
- and return &false; under Windows.
-
-
-
- See also
- stream_set_blocking.
-
-
-
+
+
+
+
+
+ If you read/write to a stream returned in the arrays be aware that
+ they do not necessarily read/write the full amount of data you have
+ requested. Be prepared to even only be able to read/write a single
+ byte.
+
+
+
+
+ Windows compatibility: stream_select used on a
+ pipe returned from proc_open may cause data loss
+ under Windows 98.
+
+
+ Use of stream_select on
+ file descriptors returned by proc_open will fail
+ and return &false; under Windows.
+
+
+
+ See also
+ stream_set_blocking.
+
+
+
+
-
-
- stream_set_blocking
- Set blocking/non-blocking mode on a stream
-
-
- Description
-
- boolstream_set_blocking
- resourcestream
- intmode
-
-
- If mode is 0, the given stream
- will be switched to non-blocking mode, and if 1, it
- will be switched to blocking mode. This affects calls like
- fgets and fread
- that read from the stream. In non-blocking mode an
- fgets call will always return right away
- while in blocking mode it will wait for data to become available
- on the stream.
-
-
- &return.success;
-
-
- This function was previously called as
- set_socket_blocking and later
- socket_set_blocking but this usage is deprecated.
-
-
-
- Prior to PHP 4.3, this function only worked on socket based streams.
- Since PHP 4.3, this function works for any stream that supports
- non-blocking mode (currently, regular files and socket streams).
-
-
-
- See also
- stream_select.
-
-
-
+
+
+ stream_set_blocking
+ Set blocking/non-blocking mode on a stream
+
+
+ Description
+
+ boolstream_set_blocking
+ resourcestream
+ intmode
+
+
+ If mode is 0, the given stream
+ will be switched to non-blocking mode, and if 1, it
+ will be switched to blocking mode. This affects calls like
+ fgets and fread
+ that read from the stream. In non-blocking mode an
+ fgets call will always return right away
+ while in blocking mode it will wait for data to become available
+ on the stream.
+
+
+ &return.success;
+
+
+ This function was previously called as
+ set_socket_blocking and later
+ socket_set_blocking but this usage is deprecated.
+
+
+
+ Prior to PHP 4.3, this function only worked on socket based streams.
+ Since PHP 4.3, this function works for any stream that supports
+ non-blocking mode (currently, regular files and socket streams).
+
+
+
+ See also
+ stream_select.
+
+
+
+
-
-
- stream_set_timeout
- Set timeout period on a stream
-
-
- Description
-
- boolstream_set_timeout
- resourcestream
- intseconds
- intmicroseconds
-
-
- Sets the timeout value on stream,
- expressed in the sum of seconds and
- microseconds. &return.success;
-
-
- When the stream times out, the 'timed_out' key of the array returned by
- stream_get_meta_data is set to &true;, although no
- error/warning is generated.
-
-
-
- stream_set_timeout example
-
+
+
+ stream_set_timeout
+ Set timeout period on a stream
+
+
+ Description
+
+ boolstream_set_timeout
+ resourcestream
+ intseconds
+ intmicroseconds
+
+
+ Sets the timeout value on stream,
+ expressed in the sum of seconds and
+ microseconds. &return.success;
+
+
+ When the stream times out, the 'timed_out' key of the array returned by
+ stream_get_meta_data is set to &true;, although no
+ error/warning is generated.
+
+
+
+ stream_set_timeout example
+
]]>
-
-
-
-
-
- As of PHP 4.3, this function can (potentially) work on any kind of
- stream. In PHP 4.3, socket based streams are still the only kind
- supported in the PHP core, although streams from other extensions
- may support this function.
-
-
-
-
- This function doesn't work with advanced operations like
- stream_socket_recvfrom, use
- stream_select with timeout parameter instead.
-
-
-
- This function was previously called as
- set_socket_timeout and later
- socket_set_timeout but this usage is deprecated.
-
-
- See also
- fsockopen and
- fopen.
-
-
-
+
+
+
+
+
+ As of PHP 4.3, this function can (potentially) work on any kind of
+ stream. In PHP 4.3, socket based streams are still the only kind
+ supported in the PHP core, although streams from other extensions
+ may support this function.
+
+
+
+
+ This function doesn't work with advanced operations like
+ stream_socket_recvfrom, use
+ stream_select with timeout parameter instead.
+
+
+
+ This function was previously called as
+ set_socket_timeout and later
+ socket_set_timeout but this usage is deprecated.
+
+
+ See also
+ fsockopen and
+ fopen.
+
+
+
+
-
-
- stream_set_write_buffer
- Sets file buffering on the given stream
-
-
- Description
-
- intstream_set_write_buffer
- resourcestream
- intbuffer
-
-
- Output using fwrite is normally buffered at
- 8K. This means that if there are two processes wanting to write
- to the same output stream (a file), each is paused after 8K of
- data to allow the other to write.
- stream_set_write_buffer
- sets the buffering for write operations on the given filepointer
- stream to buffer bytes.
- If buffer is 0 then write operations are
- unbuffered. This ensures that all writes with
- fwrite are completed before other processes
- are allowed to write to that output stream.
-
-
- The function returns 0 on success, or EOF if the request cannot
- be honored.
-
-
- The following example demonstrates how to use
- stream_set_write_buffer to create an unbuffered stream.
-
- stream_set_write_buffer example
-
+
+
+ stream_set_write_buffer
+ Sets file buffering on the given stream
+
+
+ Description
+
+ intstream_set_write_buffer
+ resourcestream
+ intbuffer
+
+
+ Output using fwrite is normally buffered at
+ 8K. This means that if there are two processes wanting to write
+ to the same output stream (a file), each is paused after 8K of
+ data to allow the other to write.
+ stream_set_write_buffer
+ sets the buffering for write operations on the given filepointer
+ stream to buffer bytes.
+ If buffer is 0 then write operations are
+ unbuffered. This ensures that all writes with
+ fwrite are completed before other processes
+ are allowed to write to that output stream.
+
+
+ The function returns 0 on success, or EOF if the request cannot
+ be honored.
+
+
+ The following example demonstrates how to use
+ stream_set_write_buffer to create an unbuffered stream.
+
+ stream_set_write_buffer example
+
]]>
-
-
-
+
+
+
-
- See also
- fopen and
- fwrite.
-
-
-
+
+ See also
+ fopen and
+ fwrite.
+
+
+
-
-
- stream_socket_accept
-
- Accept a connection on a socket created by stream_socket_server
-
-
-
- Description
-
- resourcestream_socket_accept
- resourceserver_socket
- floattimeout
- stringpeername
-
-
- Accept a connection on a socket previously created by
- stream_socket_server. If
- timeout is specified, the default
- socket accept timeout will be overridden with the time
- specified in seconds. The name (address) of the client
- which connected will be passed back in peername
- if included and available from the selected transport.
-
-
- peername can also be determined later
- using stream_socket_get_name.
-
-
- If the call fails, it will return &false;.
-
-
-
- This function should not be used with UDP server sockets. Instead, use
- stream_socket_recvfrom and
- stream_socket_sendto.
-
-
-
- See also stream_socket_server,
- stream_socket_get_name,
- stream_set_blocking,
- stream_set_timeout,
- fgets,
- fgetss, fwrite,
- fclose, feof, and
- the Curl extension.
-
-
-
+
+
+
+ stream_socket_accept
+ Accept a connection on a socket created by stream_socket_server
+
+
+ Description
+
+ resourcestream_socket_accept
+ resourceserver_socket
+ floattimeout
+ stringpeername
+
+
+ Accept a connection on a socket previously created by
+ stream_socket_server. If
+ timeout is specified, the default
+ socket accept timeout will be overridden with the time
+ specified in seconds. The name (address) of the client
+ which connected will be passed back in peername
+ if included and available from the selected transport.
+
+
+ peername can also be determined later
+ using stream_socket_get_name.
+
+
+ If the call fails, it will return &false;.
+
+
+
+ This function should not be used with UDP server sockets. Instead, use
+ stream_socket_recvfrom and
+ stream_socket_sendto.
+
+
+
+ See also stream_socket_server,
+ stream_socket_get_name,
+ stream_set_blocking,
+ stream_set_timeout,
+ fgets,
+ fgetss, fwrite,
+ fclose, feof, and
+ the Curl extension.
+
+
+
-
-
- stream_socket_client
-
- Open Internet or Unix domain socket connection
-
-
-
- Description
-
- resourcestream_socket_client
- stringremote_socket
- interrno
- stringerrstr
- floattimeout
- intflags
- resourcecontext
-
-
- Initiates a stream or datagram connection to the destination specified
- by remote_socket. The type of socket created
- is determined by the transport specified using standard URL formatting:
- transport://target. For Internet Domain sockets
- (AF_INET) such as TCP and UDP, the target portion
- of the remote_socket parameter should consist of
- a hostname or IP address followed by a colon and a port number. For Unix
- domain sockets, the target portion should point
- to the socket file on the filesystem.
+
+
+
+ stream_socket_client
+ Open Internet or Unix domain socket connection
+
+
+ Description
+
+ resourcestream_socket_client
+ stringremote_socket
+ interrno
+ stringerrstr
+ floattimeout
+ intflags
+ resourcecontext
+
+
+ Initiates a stream or datagram connection to the destination specified
+ by remote_socket. The type of socket created
+ is determined by the transport specified using standard URL formatting:
+ transport://target. For Internet Domain sockets
+ (AF_INET) such as TCP and UDP, the target portion
+ of the remote_socket parameter should consist of
+ a hostname or IP address followed by a colon and a port number. For Unix
+ domain sockets, the target portion should point
+ to the socket file on the filesystem.
- The optional timeout can be used to
- set a timeout in seconds for the connect system call.
+ The optional timeout can be used to
+ set a timeout in seconds for the connect system call.
- flags is a bitmask field which may be set to any
- combination of connection flags. Currently the selection of connection
- flags is limited to STREAM_CLIENT_CONNECT (default),
- STREAM_CLIENT_ASYNC_CONNECT and
- STREAM_CLIENT_PERSISTENT.
-
-
-
- If you need to set a timeout for reading/writing data over the socket,
- use stream_set_timeout, as the timeout
- parameter to stream_socket_client only applies while
- connecting the socket.
-
-
-
-
- The timeout parameter only applies if you are not making an asynchronous
- connection attempt.
-
-
-
- stream_socket_client returns a
- stream resource which may
- be used together with the other file functions (such as
- fgets, fgetss,
- fwrite, fclose, and
- feof).
-
-
- If the call fails, it will return &false; and if the optional
- errno and errstr
- arguments are present they will be set to indicate the actual
- system level error that occurred in the system-level
- connect() call. If the value returned in
- errno is 0 and the
- function returned &false;, it is an indication that the error
- occurred before the connect() call. This is
- most likely due to a problem initializing the socket. Note that
- the errno and
- errstr arguments will always be passed by
- reference.
-
-
- Depending on the environment, the Unix domain or the optional
- connect timeout may not be available. A list of available
- transports can be retrieved using stream_get_transports.
- See for a list of built in transports.
-
-
- The stream will by default be opened in blocking mode. You can
- switch it to non-blocking mode by using
- stream_set_blocking.
-
- stream_socket_client Example
-
+ flags is a bitmask field which may be set to any
+ combination of connection flags. Currently the selection of connection
+ flags is limited to STREAM_CLIENT_CONNECT (default),
+ STREAM_CLIENT_ASYNC_CONNECT and
+ STREAM_CLIENT_PERSISTENT.
+
+
+
+ If you need to set a timeout for reading/writing data over the socket,
+ use stream_set_timeout, as the timeout
+ parameter to stream_socket_client only applies while
+ connecting the socket.
+
+
+
+
+ The timeout parameter only applies if you are not making an asynchronous
+ connection attempt.
+
+
+
+ stream_socket_client returns a
+ stream resource which may
+ be used together with the other file functions (such as
+ fgets, fgetss,
+ fwrite, fclose, and
+ feof).
+
+
+ If the call fails, it will return &false; and if the optional
+ errno and errstr
+ arguments are present they will be set to indicate the actual
+ system level error that occurred in the system-level
+ connect() call. If the value returned in
+ errno is 0 and the
+ function returned &false;, it is an indication that the error
+ occurred before the connect() call. This is
+ most likely due to a problem initializing the socket. Note that
+ the errno and
+ errstr arguments will always be passed by
+ reference.
+
+
+ Depending on the environment, the Unix domain or the optional
+ connect timeout may not be available. A list of available
+ transports can be retrieved using stream_get_transports.
+ See for a list of built in transports.
+
+
+ The stream will by default be opened in blocking mode. You can
+ switch it to non-blocking mode by using
+ stream_set_blocking.
+
+ stream_socket_client Example
+
]]>
-
-
- The example below shows how to retrieve the day and time
- from the UDP service "daytime" (port 13) in your own machine.
-
- Using UDP connection
-
+
+
+ The example below shows how to retrieve the day and time
+ from the UDP service "daytime" (port 13) in your own machine.
+
+ Using UDP connection
+
]]>
-
-
-
-
- UDP sockets will sometimes appear to have opened without an error,
- even if the remote host is unreachable. The error will only
- become apparent when you read or write data to/from the socket.
- The reason for this is because UDP is a "connectionless" protocol,
- which means that the operating system does not try to establish
- a link for the socket until it actually needs to send or receive data.
-
-
-
- &ipv6.brackets;
-
- See also stream_socket_server,
- stream_set_blocking,
- stream_set_timeout,
- stream_select,
- fgets,
- fgetss, fwrite,
- fclose, feof, and
- the Curl extension.
-
-
-
+
+
+
+
+ UDP sockets will sometimes appear to have opened without an error,
+ even if the remote host is unreachable. The error will only
+ become apparent when you read or write data to/from the socket.
+ The reason for this is because UDP is a "connectionless" protocol,
+ which means that the operating system does not try to establish
+ a link for the socket until it actually needs to send or receive data.
+
+
+
+ &ipv6.brackets;
+
+ See also stream_socket_server,
+ stream_set_blocking,
+ stream_set_timeout,
+ stream_select,
+ fgets,
+ fgetss, fwrite,
+ fclose, feof, and
+ the Curl extension.
+
+
+
-
-
- stream_socket_enable_crypto
-
- Turns encryption on/off on an already connected socket
-
-
-
- Description
-
- mixedstream_socket_enable_crypto
- resourcestream
- boolenable
- intcrypto_type
- resourcesession_stream
-
+
+
+
+ stream_socket_enable_crypto
+ Turns encryption on/off on an already connected socket
+
+
+ Description
+
+ mixedstream_socket_enable_crypto
+ resourcestream
+ boolenable
+ intcrypto_type
+ resourcesession_stream
+
-
- When called with the crypto_type parameter,
- stream_socket_enable_crypto will setup
- encryption on the stream using the specified method.
-
+
+ When called with the crypto_type parameter,
+ stream_socket_enable_crypto will setup
+ encryption on the stream using the specified method.
+
-
- Valid values for crypto_type
-
- STREAM_CRYPTO_METHOD_SSLv2_CLIENT
- STREAM_CRYPTO_METHOD_SSLv3_CLIENT
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT
- STREAM_CRYPTO_METHOD_TLS_CLIENT
- STREAM_CRYPTO_METHOD_SSLv2_SERVER
- STREAM_CRYPTO_METHOD_SSLv3_SERVER
- STREAM_CRYPTO_METHOD_SSLv23_SERVER
- STREAM_CRYPTO_METHOD_TLS_SERVER
-
-
+
+ Valid values for crypto_type
+
+ STREAM_CRYPTO_METHOD_SSLv2_CLIENT
+ STREAM_CRYPTO_METHOD_SSLv3_CLIENT
+ STREAM_CRYPTO_METHOD_SSLv23_CLIENT
+ STREAM_CRYPTO_METHOD_TLS_CLIENT
+ STREAM_CRYPTO_METHOD_SSLv2_SERVER
+ STREAM_CRYPTO_METHOD_SSLv3_SERVER
+ STREAM_CRYPTO_METHOD_SSLv23_SERVER
+ STREAM_CRYPTO_METHOD_TLS_SERVER
+
+
-
- Once the crypto settings are established, cryptography can be turned
- on and off dynamically by passing &true; or &false; in the
- enable parameter.
-
+
+ Once the crypto settings are established, cryptography can be turned
+ on and off dynamically by passing &true; or &false; in the
+ enable parameter.
+
-
- If this stream should be seeded with settings from an already established
- crypto enabled stream, pass that stream's resource variable
- in the fourth parameter.
-
+
+ If this stream should be seeded with settings from an already established
+ crypto enabled stream, pass that stream's resource variable
+ in the fourth parameter.
+
-
- Returns &true; on success, &false; if negotiation has failed or
- 0 if there isn't enough data and you should try again
- (only for non-blocking sockets).
-
+
+ Returns &true; on success, &false; if negotiation has failed or
+ 0 if there isn't enough data and you should try again
+ (only for non-blocking sockets).
+
-
- stream_socket_enable_crypto Example
-
+
+ stream_socket_enable_crypto Example
+
]]>
-
-
+
+
-
- , and
-
-
-
-
+
+ , and
+
+
+
+
-
-
- stream_socket_get_name
- Retrieve the name of the local or remote sockets
-
-
- Description
-
- stringstream_socket_get_name
- resourcehandle
- boolwant_peer
-
-
- Returns the local or remote name of a given socket connection.
- If want_peer is set to &true; the remote
- socket name will be returned, if it is set to &false; the local
- socket name will be returned.
-
-
- See also
- stream_socket_accept.
-
-
-
+
+
+
+ stream_socket_get_name
+ Retrieve the name of the local or remote sockets
+
+
+ Description
+
+ stringstream_socket_get_name
+ resourcehandle
+ boolwant_peer
+
+
+ Returns the local or remote name of a given socket connection.
+ If want_peer is set to &true; the remote
+ socket name will be returned, if it is set to &false; the local
+ socket name will be returned.
+
+
+ See also
+ stream_socket_accept.
+
+
+
-
-
- stream_socket_recvfrom
- Receives data from a socket, connected or not
-
-
- Description
-
- stringstream_socket_recvfrom
- resourcesocket
- intlength
- intflags
- stringaddress
-
-
- The function stream_socket_recvfrom accepts
- data from a remote socket up to length bytes.
- If address is provided it will be populated with
- the address of the remote socket.
-
-
- The value of flags can be any combination
- of the following:
-
- possible values for flags
-
-
-
- STREAM_OOB
-
- Process OOB (out-of-band) data.
-
-
-
- STREAM_PEEK
-
- Retrieve data from the socket, but do not consume the buffer.
- Subsequent calls to fread or
- stream_socket_recvfrom will see
- the same data.
-
-
-
-
-
-
-
- stream_socket_recvfrom Example
-
+
+
+
+ stream_socket_recvfrom
+ Receives data from a socket, connected or not
+
+
+ Description
+
+ stringstream_socket_recvfrom
+ resourcesocket
+ intlength
+ intflags
+ stringaddress
+
+
+ The function stream_socket_recvfrom accepts
+ data from a remote socket up to length bytes.
+ If address is provided it will be populated with
+ the address of the remote socket.
+
+
+ The value of flags can be any combination
+ of the following:
+
+ possible values for flags
+
+
+
+ STREAM_OOB
+
+ Process OOB (out-of-band) data.
+
+
+
+ STREAM_PEEK
+
+ Retrieve data from the socket, but do not consume the buffer.
+ Subsequent calls to fread or
+ stream_socket_recvfrom will see
+ the same data.
+
+
+
+
+
+
+
+ stream_socket_recvfrom Example
+
]]>
-
-
-
-
- If a message received is longer than the length
- parameter, excess bytes may be discarded depending on the type of socket
- the message is received from (such as UDP).
-
-
-
-
- Calls to stream_socket_recvfrom on socket-based
- streams, after calls to buffer-based stream functions (like
- fread or stream_get_line) read
- data directly from the socket and bypass the stream buffer.
-
-
-
- See also
- stream_socket_sendto,
- stream_socket_client, and
- stream_socket_server.
+
+
+
+
+ If a message received is longer than the length
+ parameter, excess bytes may be discarded depending on the type of socket
+ the message is received from (such as UDP).
+
+
+
+
+ Calls to stream_socket_recvfrom on socket-based
+ streams, after calls to buffer-based stream functions (like
+ fread or stream_get_line) read
+ data directly from the socket and bypass the stream buffer.
-
-
+
+
+ See also
+ stream_socket_sendto,
+ stream_socket_client, and
+ stream_socket_server.
+
+
+
-
-
- stream_socket_sendto
- Sends a message to a socket, whether it is connected or not
-
-
- Description
-
- intstream_socket_sendto
- resourcesocket
- stringdata
- intflags
- stringaddress
-
-
- The function stream_socket_sendto sends
- the data specified by data through the
- socket specified by socket. The address
- specified when the socket stream was created will be used unless
- an alternate address is specified in address.
-
-
- The value of flags can be any combination
- of the following:
-
- possible values for flags
-
-
-
- STREAM_OOB
-
- Process OOB (out-of-band) data.
-
-
-
-
-
-
-
- stream_socket_sendto Example
-
+
+
+
+ stream_socket_sendto
+ Sends a message to a socket, whether it is connected or not
+
+
+ Description
+
+ intstream_socket_sendto
+ resourcesocket
+ stringdata
+ intflags
+ stringaddress
+
+
+ The function stream_socket_sendto sends
+ the data specified by data through the
+ socket specified by socket. The address
+ specified when the socket stream was created will be used unless
+ an alternate address is specified in address.
+
+
+ The value of flags can be any combination
+ of the following:
+
+ possible values for flags
+
+
+
+ STREAM_OOB
+
+ Process OOB (out-of-band) data.
+
+
+
+
+
+
+
+ stream_socket_sendto Example
+
]]>
-
-
-
- See also
- stream_socket_recvfrom,
- stream_socket_client, and
- stream_socket_server.
-
-
-
+
+
+
+ See also
+ stream_socket_recvfrom,
+ stream_socket_client, and
+ stream_socket_server.
+
+
+
-
-
- stream_socket_server
-
- Create an Internet or Unix domain server socket
-
-
-
- Description
-
- resourcestream_socket_server
- stringlocal_socket
- interrno
- stringerrstr
- intflags
- resourcecontext
-
-
- Creates a stream or datagram socket on the specified
- local_socket. The type of socket created
- is determined by the transport specified using standard URL formatting:
- transport://target. For Internet Domain sockets
- (AF_INET) such as TCP and UDP, the target portion
- of the remote_socket parameter should consist of
- a hostname or IP address followed by a colon and a port number. For Unix
- domain sockets, the target portion should point
- to the socket file on the filesystem.
+
+
+
+ stream_socket_server
+ Create an Internet or Unix domain server socket
+
+
+ Description
+
+ resourcestream_socket_server
+ stringlocal_socket
+ interrno
+ stringerrstr
+ intflags
+ resourcecontext
+
+
+ Creates a stream or datagram socket on the specified
+ local_socket. The type of socket created
+ is determined by the transport specified using standard URL formatting:
+ transport://target. For Internet Domain sockets
+ (AF_INET) such as TCP and UDP, the target portion
+ of the remote_socket parameter should consist of
+ a hostname or IP address followed by a colon and a port number. For Unix
+ domain sockets, the target portion should point
+ to the socket file on the filesystem.
- flags is a bitmask field which may be set to any
- combination of socket creation flags. The default value of flags is
- STREAM_SERVER_BIND | STREAM_SERVER_LISTEN.
-
-
-
- For UDP sockets, you must use STREAM_SERVER_BIND as
- the flags parameter.
-
-
-
- This function only creates a socket, to begin accepting connections
- use stream_socket_accept.
-
-
- If the call fails, it will return &false; and if the optional
- errno and errstr
- arguments are present they will be set to indicate the actual
- system level error that occurred in the system-level
- socket(), bind(), and
- listen() calls. If the value returned in
- errno is 0 and the
- function returned &false;, it is an indication that the error
- occurred before the bind() call. This is
- most likely due to a problem initializing the socket. Note that
- the errno and
- errstr arguments will always be passed by
- reference.
-
-
- Depending on the environment, Unix domain sockets may not be available.
- A list of available transports can be retrieved using
- stream_get_transports. See
- for a list of bulitin transports.
-
-
-
- Using TCP server sockets
-
+ flags is a bitmask field which may be set to any
+ combination of socket creation flags. The default value of flags is
+ STREAM_SERVER_BIND | STREAM_SERVER_LISTEN.
+
+
+
+ For UDP sockets, you must use STREAM_SERVER_BIND as
+ the flags parameter.
+
+
+
+ This function only creates a socket, to begin accepting connections
+ use stream_socket_accept.
+
+
+ If the call fails, it will return &false; and if the optional
+ errno and errstr
+ arguments are present they will be set to indicate the actual
+ system level error that occurred in the system-level
+ socket(), bind(), and
+ listen() calls. If the value returned in
+ errno is 0 and the
+ function returned &false;, it is an indication that the error
+ occurred before the bind() call. This is
+ most likely due to a problem initializing the socket. Note that
+ the errno and
+ errstr arguments will always be passed by
+ reference.
+
+
+ Depending on the environment, Unix domain sockets may not be available.
+ A list of available transports can be retrieved using
+ stream_get_transports. See
+ for a list of bulitin transports.
+
+
+
+ Using TCP server sockets
+
]]>
-
-
-
-
- The example below shows how to act as a time server which can respond
- to time queries as shown in an example on stream_socket_client.
-
-
- Most systems require root access to create a server socket on a port
- below 1024.
-
-
-
- Using UDP server sockets
-
+
+
+
+
+ The example below shows how to act as a time server which can respond
+ to time queries as shown in an example on stream_socket_client.
+
+
+ Most systems require root access to create a server socket on a port
+ below 1024.
+
+
+
+ Using UDP server sockets
+
]]>
-
-
-
- &ipv6.brackets;
-
- See also stream_socket_client,
- stream_set_blocking,
- stream_set_timeout,
- fgets,
- fgetss, fwrite,
- fclose, feof, and
- the Curl extension.
-
-
-
+
+
+
+ &ipv6.brackets;
+
+ See also stream_socket_client,
+ stream_set_blocking,
+ stream_set_timeout,
+ fgets,
+ fgetss, fwrite,
+ fclose, feof, and
+ the Curl extension.
+
+
+
-
-
- stream_wrapper_register
- Register a URL wrapper implemented as a PHP class
-
-
- Description
-
- boolstream_wrapper_register
- stringprotocol
- stringclassname
-
-
- stream_wrapper_register allows you to implement
- your own protocol handlers and streams for use with all the other
- filesystem functions (such as fopen,
- fread etc.).
-
-
- To implement a wrapper, you need to define a class with a number of
- member functions, as defined below. When someone fopens your stream,
- PHP will create an instance of classname and
- then call methods on that instance. You must implement the methods
- exactly as described below - doing otherwise will lead to undefined
- behaviour.
-
-
-
- As of PHP 5.0.0 the instance of
- classname will be populated with a
- context property referencing a
- Context Resource which may be accessed
- with stream_context_get_options.
- If no context was passed to the stream creation function,
- context will be set to &null;.
-
-
-
- stream_wrapper_register will return &false; if the
- protocol already has a handler.
-
+
+
+
+ stream_wrapper_register
+ Register a URL wrapper implemented as a PHP class
+
+
+ Description
+
+ boolstream_wrapper_register
+ stringprotocol
+ stringclassname
+
+
+ stream_wrapper_register allows you to implement
+ your own protocol handlers and streams for use with all the other
+ filesystem functions (such as fopen,
+ fread etc.).
+
+
+ To implement a wrapper, you need to define a class with a number of
+ member functions, as defined below. When someone fopens your stream,
+ PHP will create an instance of classname and
+ then call methods on that instance. You must implement the methods
+ exactly as described below - doing otherwise will lead to undefined
+ behaviour.
+
+
+
+ As of PHP 5.0.0 the instance of
+ classname will be populated with a
+ context property referencing a
+ Context Resource which may be accessed
+ with stream_context_get_options.
+ If no context was passed to the stream creation function,
+ context will be set to &null;.
+
+
+
+ stream_wrapper_register will return &false; if the
+ protocol already has a handler.
+
-
- boolstream_open
- stringpath
- stringmode
- intoptions
- stringopened_path
-
-
- This method is called immediately after your stream object is
- created. path specifies the URL that was
- passed to fopen and that this object is
- expected to retrieve. You can use parse_url
- to break it apart.
-
-
- mode is the mode used to open the file,
- as detailed for fopen. You are responsible
- for checking that mode is valid for the
- path requested.
-
-
- options holds additional flags set
- by the streams API. It can hold one or more of the following
- values OR'd together.
-
-
-
-
- Flag
- Description
-
-
-
-
- STREAM_USE_PATH
- If path is relative, search
- for the resource using the include_path.
-
-
-
- STREAM_REPORT_ERRORS
- If this flag is set, you are responsible for raising
- errors using trigger_error during
- opening of the stream. If this flag is not set, you
- should not raise any errors.
-
-
-
-
-
-
-
- If the path is opened successfully,
- and STREAM_USE_PATH is set in options,
- you should set opened_path to the full
- path of the file/resource that was actually opened.
-
-
- If the requested resource was opened successfully, you should
- return &true;, otherwise you should return &false;
-
+
+ boolstream_open
+ stringpath
+ stringmode
+ intoptions
+ stringopened_path
+
+
+ This method is called immediately after your stream object is
+ created. path specifies the URL that was
+ passed to fopen and that this object is
+ expected to retrieve. You can use parse_url
+ to break it apart.
+
+
+ mode is the mode used to open the file,
+ as detailed for fopen. You are responsible
+ for checking that mode is valid for the
+ path requested.
+
+
+ options holds additional flags set
+ by the streams API. It can hold one or more of the following
+ values OR'd together.
+
+
+
+
+ Flag
+ Description
+
+
+
+
+ STREAM_USE_PATH
+ If path is relative, search
+ for the resource using the include_path.
+
+
+
+ STREAM_REPORT_ERRORS
+ If this flag is set, you are responsible for raising
+ errors using trigger_error during
+ opening of the stream. If this flag is not set, you
+ should not raise any errors.
+
+
+
+
+
+
+
+ If the path is opened successfully,
+ and STREAM_USE_PATH is set in options,
+ you should set opened_path to the full
+ path of the file/resource that was actually opened.
+
+
+ If the requested resource was opened successfully, you should
+ return &true;, otherwise you should return &false;
+
-
- voidstream_close
-
-
-
- This method is called when the stream is closed, using
- fclose. You must release any resources
- that were locked or allocated by the stream.
-
+
+ voidstream_close
+
+
+
+ This method is called when the stream is closed, using
+ fclose. You must release any resources
+ that were locked or allocated by the stream.
+
-
- stringstream_read
- intcount
-
-
- This method is called in response to fread
- and fgets calls on the stream. You
- must return up-to count bytes of data
- from the current read/write position as a string.
- If there are less than count
- bytes available, return as many as are available. If no
- more data is available, return either &false; or an
- empty string.
- You must also update the read/write position of the stream
- by the number of bytes that were successfully read.
-
+
+ stringstream_read
+ intcount
+
+
+ This method is called in response to fread
+ and fgets calls on the stream. You
+ must return up-to count bytes of data
+ from the current read/write position as a string.
+ If there are less than count
+ bytes available, return as many as are available. If no
+ more data is available, return either &false; or an
+ empty string.
+ You must also update the read/write position of the stream
+ by the number of bytes that were successfully read.
+
-
- intstream_write
- stringdata
-
-
- This method is called in response to fwrite
- calls on the stream. You should store data
- into the underlying storage used by your stream. If there is not
- enough room, try to store as many bytes as possible.
- You should return the number of bytes that were successfully
- stored in the stream, or 0 if none could be stored.
- You must also update the read/write position of the stream
- by the number of bytes that were successfully written.
-
-
-
- boolstream_eof
-
-
-
- This method is called in response to feof
- calls on the stream. You should return &true; if the read/write
- position is at the end of the stream and if no more data is available
- to be read, or &false; otherwise.
-
+
+ intstream_write
+ stringdata
+
+
+ This method is called in response to fwrite
+ calls on the stream. You should store data
+ into the underlying storage used by your stream. If there is not
+ enough room, try to store as many bytes as possible.
+ You should return the number of bytes that were successfully
+ stored in the stream, or 0 if none could be stored.
+ You must also update the read/write position of the stream
+ by the number of bytes that were successfully written.
+
-
- intstream_tell
-
-
-
- This method is called in response to ftell
- calls on the stream. You should return the current read/write
- position of the stream.
-
+
+ boolstream_eof
+
+
+
+ This method is called in response to feof
+ calls on the stream. You should return &true; if the read/write
+ position is at the end of the stream and if no more data is available
+ to be read, or &false; otherwise.
+
-
- boolstream_seek
- intoffset
- intwhence
-
-
- This method is called in response to fseek
- calls on the stream. You should update the read/write position
- of the stream according to offset and
- whence. See fseek
- for more information about these parameters.
- Return &true; if the position was updated, &false; otherwise.
-
+
+ intstream_tell
+
+
+
+ This method is called in response to ftell
+ calls on the stream. You should return the current read/write
+ position of the stream.
+
-
- boolstream_flush
-
-
-
- This method is called in response to fflush
- calls on the stream. If you have cached data in your stream
- but not yet stored it into the underlying storage, you should
- do so now.
- Return &true; if the cached data was successfully stored (or
- if there was no data to store), or &false; if the data could
- not be stored.
-
+
+ boolstream_seek
+ intoffset
+ intwhence
+
+
+ This method is called in response to fseek
+ calls on the stream. You should update the read/write position
+ of the stream according to offset and
+ whence. See fseek
+ for more information about these parameters.
+ Return &true; if the position was updated, &false; otherwise.
+
-
- arraystream_stat
-
-
-
- This method is called in response to fstat
- calls on the stream and should return an array containing the same
- values as appropriate for the stream.
-
+
+ boolstream_flush
+
+
+
+ This method is called in response to fflush
+ calls on the stream. If you have cached data in your stream
+ but not yet stored it into the underlying storage, you should
+ do so now.
+ Return &true; if the cached data was successfully stored (or
+ if there was no data to store), or &false; if the data could
+ not be stored.
+
-
- boolunlink
- stringpath
-
-
- This method is called in response to unlink
- calls on URL paths associated with the wrapper and should attempt
- to delete the item specified by path.
- It should return &true; on success or &false; on failure.
- In order for the appropriate error message to be returned,
- do not define this method if your wrapper does not support unlinking.
-
-
-
- Userspace wrapper unlink method is not supported prior to
- PHP 5.0.0.
-
-
+
+ arraystream_stat
+
+
+
+ This method is called in response to fstat
+ calls on the stream and should return an array containing the same
+ values as appropriate for the stream.
+
-
- boolrename
- stringpath_from
- stringpath_to
-
-
- This method is called in response to rename
- calls on URL paths associated with the wrapper and should attempt
- to rename the item specified by path_from
- to the specification given by path_to.
- It should return &true; on success or &false; on failure.
- In order for the appropriate error message to be returned,
- do not define this method if your wrapper does not support renaming.
-
-
-
- Userspace wrapper rename method is not supported prior to
- PHP 5.0.0.
-
-
+
+ boolunlink
+ stringpath
+
+
+ This method is called in response to unlink
+ calls on URL paths associated with the wrapper and should attempt
+ to delete the item specified by path.
+ It should return &true; on success or &false; on failure.
+ In order for the appropriate error message to be returned,
+ do not define this method if your wrapper does not support unlinking.
+
+
+
+ Userspace wrapper unlink method is not supported prior to
+ PHP 5.0.0.
+
+
-
- boolmkdir
- stringpath
- intmode
- intoptions
-
-
- This method is called in response to mkdir
- calls on URL paths associated with the wrapper and should attempt
- to create the directory specified by path.
- It should return &true; on success or &false; on failure.
- In order for the appropriate error message to be returned,
- do not define this method if your wrapper does not support
- creating directories. Posible values for options
- include STREAM_REPORT_ERRORS and
- STREAM_MKDIR_RECURSIVE.
-
-
-
- Userspace wrapper mkdir method is not supported prior to
- PHP 5.0.0.
-
-
+
+ boolrename
+ stringpath_from
+ stringpath_to
+
+
+ This method is called in response to rename
+ calls on URL paths associated with the wrapper and should attempt
+ to rename the item specified by path_from
+ to the specification given by path_to.
+ It should return &true; on success or &false; on failure.
+ In order for the appropriate error message to be returned,
+ do not define this method if your wrapper does not support renaming.
+
+
+
+ Userspace wrapper rename method is not supported prior to
+ PHP 5.0.0.
+
+
-
- boolrmdir
- stringpath
- intoptions
-
-
- This method is called in response to rmdir
- calls on URL paths associated with the wrapper and should attempt
- to remove the directory specified by path.
- It should return &true; on success or &false; on failure.
- In order for the appropriate error message to be returned,
- do not define this method if your wrapper does not support
- removing directories. Possible values for options
- include STREAM_REPORT_ERRORS.
-
-
-
- Userspace wrapper rmdir method is not supported prior to
- PHP 5.0.0.
-
-
+
+ boolmkdir
+ stringpath
+ intmode
+ intoptions
+
+
+ This method is called in response to mkdir
+ calls on URL paths associated with the wrapper and should attempt
+ to create the directory specified by path.
+ It should return &true; on success or &false; on failure.
+ In order for the appropriate error message to be returned,
+ do not define this method if your wrapper does not support
+ creating directories. Posible values for options
+ include STREAM_REPORT_ERRORS and
+ STREAM_MKDIR_RECURSIVE.
+
+
+
+ Userspace wrapper mkdir method is not supported prior to
+ PHP 5.0.0.
+
+
-
- booldir_opendir
- stringpath
- intoptions
-
-
- This method is called immediately when your stream object is created for
- examining directory contents with opendir.
- path specifies the URL that was
- passed to opendir and that this object is
- expected to explore. You can use parse_url
- to break it apart.
-
+
+ boolrmdir
+ stringpath
+ intoptions
+
+
+ This method is called in response to rmdir
+ calls on URL paths associated with the wrapper and should attempt
+ to remove the directory specified by path.
+ It should return &true; on success or &false; on failure.
+ In order for the appropriate error message to be returned,
+ do not define this method if your wrapper does not support
+ removing directories. Possible values for options
+ include STREAM_REPORT_ERRORS.
+
+
+
+ Userspace wrapper rmdir method is not supported prior to
+ PHP 5.0.0.
+
+
-
- arrayurl_stat
- stringpath
- intflags
-
-
- This method is called in response to stat
- calls on the URL paths associated with the wrapper and should
- return as many elements in common with the system function as
- possible. Unknown or unavailable values should be set to a
- rational value (usually 0).
-
-
- flags holds additional flags set
- by the streams API. It can hold one or more of the following
- values OR'd together.
-
-
-
-
- Flag
- Description
-
-
-
-
- STREAM_URL_STAT_LINK
-
- For resources with the ability to link to other resource
- (such as an HTTP Location: forward, or a filesystem
- symlink). This flag specified that only information
- about the link itself should be returned, not the
- resource pointed to by the link. This flag is set in
- response to calls to lstat,
- is_link, or filetype.
-
-
-
- STREAM_URL_STAT_QUIET
- If this flag is set, your wrapper should not raise any
- errors. If this flag is not set, you are responsible for
- reporting errors using the trigger_error
- function during stating of the path.
-
-
-
-
-
-
+
+ booldir_opendir
+ stringpath
+ intoptions
+
+
+ This method is called immediately when your stream object is created for
+ examining directory contents with opendir.
+ path specifies the URL that was
+ passed to opendir and that this object is
+ expected to explore. You can use parse_url
+ to break it apart.
+
-
- stringdir_readdir
-
-
-
- This method is called in response to readdir
- and should return a string representing the next filename in the
- location opened by dir_opendir.
-
+
+ arrayurl_stat
+ stringpath
+ intflags
+
+
+ This method is called in response to stat
+ calls on the URL paths associated with the wrapper and should
+ return as many elements in common with the system function as
+ possible. Unknown or unavailable values should be set to a
+ rational value (usually 0).
+
+
+ flags holds additional flags set
+ by the streams API. It can hold one or more of the following
+ values OR'd together.
+
+
+
+
+ Flag
+ Description
+
+
+
+
+ STREAM_URL_STAT_LINK
+
+ For resources with the ability to link to other resource
+ (such as an HTTP Location: forward, or a filesystem
+ symlink). This flag specified that only information
+ about the link itself should be returned, not the
+ resource pointed to by the link. This flag is set in
+ response to calls to lstat,
+ is_link, or filetype.
+
+
+
+ STREAM_URL_STAT_QUIET
+ If this flag is set, your wrapper should not raise any
+ errors. If this flag is not set, you are responsible for
+ reporting errors using the trigger_error
+ function during stating of the path.
+
+
+
+
+
+
-
- booldir_rewinddir
-
-
-
- This method is called in response to rewinddir
- and should reset the output generated by dir_readdir.
- i.e.: The next call to dir_readdir should return
- the first entry in the location returned by dir_opendir.
-
+
+ stringdir_readdir
+
+
+
+ This method is called in response to readdir
+ and should return a string representing the next filename in the
+ location opened by dir_opendir.
+
-
- booldir_closedir
-
-
-
- This method is called in response to closedir.
- You should release any resources which were locked or allocated during
- the opening and use of the directory stream.
-
+
+ booldir_rewinddir
+
+
+
+ This method is called in response to rewinddir
+ and should reset the output generated by dir_readdir.
+ i.e.: The next call to dir_readdir should return
+ the first entry in the location returned by dir_opendir.
+
+
+
+ booldir_closedir
+
+
+
+ This method is called in response to closedir.
+ You should release any resources which were locked or allocated during
+ the opening and use of the directory stream.
+
-
- The example below implements a var:// protocol handler that
- allows read/write access to a named global variable using
- standard filesystem stream functions such as fread.
- The var:// protocol implemented below, given the URL
- "var://foo" will read/write data to/from $GLOBALS["foo"].
+
+ The example below implements a var:// protocol handler that
+ allows read/write access to a named global variable using
+ standard filesystem stream functions such as fread.
+ The var:// protocol implemented below, given the URL
+ "var://foo" will read/write data to/from $GLOBALS["foo"].
-
- A Stream for reading/writing global variables
-
+
+ A Stream for reading/writing global variables
+
varname = $url["host"];
$this->position = 0;
-
+
return true;
}
- function stream_read($count)
+ function stream_read($count)
{
$ret = substr($GLOBALS[$this->varname], $this->position, $count);
$this->position += strlen($ret);
return $ret;
}
- function stream_write($data)
+ function stream_write($data)
{
$left = substr($GLOBALS[$this->varname], 0, $this->position);
$right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
@@ -429,17 +429,17 @@ class VariableStream {
return strlen($data);
}
- function stream_tell()
+ function stream_tell()
{
return $this->position;
}
- function stream_eof()
+ function stream_eof()
{
return $this->position >= strlen($GLOBALS[$this->varname]);
}
- function stream_seek($offset, $whence)
+ function stream_seek($offset, $whence)
{
switch ($whence) {
case SEEK_SET:
@@ -450,7 +450,7 @@ class VariableStream {
return false;
}
break;
-
+
case SEEK_CUR:
if ($offset >= 0) {
$this->position += $offset;
@@ -459,7 +459,7 @@ class VariableStream {
return false;
}
break;
-
+
case SEEK_END:
if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
$this->position = strlen($GLOBALS[$this->varname]) + $offset;
@@ -468,7 +468,7 @@ class VariableStream {
return false;
}
break;
-
+
default:
return false;
}
@@ -479,7 +479,7 @@ stream_wrapper_register("var", "VariableStream")
or die("Failed to register protocol");
$myvar = "";
-
+
$fp = fopen("var://myvar", "r+");
fwrite($fp, "line1\n");
@@ -495,12 +495,12 @@ var_dump($myvar);
?>
]]>
-
-
-
-
-
-
+
+
+
+
+
+
-
-
- stream_wrapper_restore
- Restores a previously unregistered built-in wrapper
-
-
- Description
-
- boolstream_wrapper_restore
- stringprotocol
-
-
- Restores a built-in wrapper previously unregistered with
- stream_wrapper_unregister.
-
-
-
+
+
+
+ stream_wrapper_restore
+ Restores a previously unregistered built-in wrapper
+
+
+ Description
+
+ boolstream_wrapper_restore
+ stringprotocol
+
+
+ Restores a built-in wrapper previously unregistered with
+ stream_wrapper_unregister.
+
+
+
-
-
- stream_wrapper_unregister
- Unregister a URL wrapper
-
-
- Description
-
- boolstream_wrapper_unregister
- stringprotocol
-
-
- stream_wrapper_unregister allows you to
- disable an already defined stream wrapper. Once the wrapper
- has been disabled you may override it with a user-defined wrapper
- using stream_wrapper_register or
- reenable it later on with stream_wrapper_restore.
-
-
-
+
+
+
+ stream_wrapper_unregister
+ Unregister a URL wrapper
+
+
+ Description
+
+ boolstream_wrapper_unregister
+ stringprotocol
+
+
+ stream_wrapper_unregister allows you to
+ disable an already defined stream wrapper. Once the wrapper
+ has been disabled you may override it with a user-defined wrapper
+ using stream_wrapper_register or
+ reenable it later on with stream_wrapper_restore.
+
+
+
+
odbc_binmode
- Handling of binary column data
-
-
- Description
-
- boolodbc_binmode
- resourceresult_id
- intmode
-
+ Handling of binary column data
+
+
+ Description
+
+ boolodbc_binmode
+ resourceresult_id
+ intmode
+
(ODBC SQL types affected: BINARY, VARBINARY, LONGVARBINARY)
-
+
ODBC_BINMODE_PASSTHRU: Passthru BINARY data
diff --git a/reference/uodbc/functions/odbc-execute.xml b/reference/uodbc/functions/odbc-execute.xml
index ad4954120d..ace233ae8f 100644
--- a/reference/uodbc/functions/odbc-execute.xml
+++ b/reference/uodbc/functions/odbc-execute.xml
@@ -1,5 +1,5 @@
-
+
@@ -53,9 +53,9 @@
If you wish to store a string which actually begins and ends with
single quotes, you must add a space or other non-single-quote character
- to the beginning or end of the parameter, which will prevent the
- parameter from being taken as a file name. If this is not an option,
- then you must use another mechanism to store the string, such as
+ to the beginning or end of the parameter, which will prevent the
+ parameter from being taken as a file name. If this is not an option,
+ then you must use another mechanism to store the string, such as
executing the query directly with odbc_exec).
diff --git a/reference/uodbc/functions/odbc-longreadlen.xml b/reference/uodbc/functions/odbc-longreadlen.xml
index 3be018cbe0..da8e2e966a 100644
--- a/reference/uodbc/functions/odbc-longreadlen.xml
+++ b/reference/uodbc/functions/odbc-longreadlen.xml
@@ -1,18 +1,18 @@
-
+
odbc_longreadlen
- Handling of LONG columns
-
-
- Description
-
- boolodbc_longreadlen
- resourceresult_id
- intlength
-
+ Handling of LONG columns
+
+
+ Description
+
+ boolodbc_longreadlen
+ resourceresult_id
+ intlength
+
(ODBC SQL types affected: LONG, LONGVARBINARY) The number of
bytes returned to PHP is controlled by the parameter length. If it
diff --git a/reference/uodbc/functions/odbc-next-result.xml b/reference/uodbc/functions/odbc-next-result.xml
index 1d06bf6e60..cade25f09f 100644
--- a/reference/uodbc/functions/odbc-next-result.xml
+++ b/reference/uodbc/functions/odbc-next-result.xml
@@ -1,33 +1,33 @@
-
+
-
-
- odbc_next_result
- Checks if multiple results are available
-
-
- Description
-
- boolodbc_next_result
- resourceresult_id
-
-
- odbc_next_result returns &true; if there are more result sets
- available as well as allowing access to the next result set via
- odbc_fetch_array, odbc_fetch_row,
- odbc_result, etc.
-
-
- This function returns &false; on error.
-
-
- The argument is a valid result identifier returned by odbc_exec.
-
-
-
- odbc_next_result
-
+
+
+ odbc_next_result
+ Checks if multiple results are available
+
+
+ Description
+
+ boolodbc_next_result
+ resourceresult_id
+
+
+ odbc_next_result returns &true; if there are more result sets
+ available as well as allowing access to the next result set via
+ odbc_fetch_array, odbc_fetch_row,
+ odbc_result, etc.
+
+
+ This function returns &false; on error.
+
+
+ The argument is a valid result identifier returned by odbc_exec.
+
+
+
+ odbc_next_result
+
]]>
-
- &example.outputs;
-
+
+ &example.outputs;
+
@@ -88,11 +88,11 @@ Dump third result set array(1) {
bool(false)
Try for a fourth result set bool(false)
]]>
-
-
-
-
-
+
+
+
+
+