X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=docs%2Ffunctions.html;h=743a151fc7ad938c919560bdb374cfd19c912321;hp=e1329bb6d9034cea8ed295454eae73dda45a755c;hb=refs%2Fheads%2Fv1.7.x;hpb=7ba82df3144551af4182de7e515f955b9b1a68a9 diff --git a/docs/functions.html b/docs/functions.html index e1329bb..743a151 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -44,54 +44,73 @@ display: block; } .toc { - position: absolute; - top: 10px; - right: 10px; - width: 300px; - height: 95%; - overflow: scroll; - font-size: .9em; - } - body>div.toc { - position: fixed; - } - .toc ul { - padding-left: 15px; - margin-left: 0; - } - .toc li { - padding: 0; - margin: 0; - } + position: absolute; + top: 10px; + right: 10px; + width: 300px; + height: 95%; + overflow: scroll; + font-size: .9em; + } + body>div.toc { + position: fixed; + } + .toc ul { + padding-left: 15px; + margin-left: 0; + } + .toc li { + padding: 0; + margin: 0; + } + .tocfile { + font-weight: bold; + }

http_functions.c

string http_date([int timestamp])

-

Compose a valid HTTP date regarding RFC 822/1123
+

Compose a valid HTTP date regarding RFC 1123
looking like: "Wed, 22 Dec 2004 11:34:47 GMT"

-

Takes an optional unix timestamp as parameter.
-
-Returns the HTTP date as string.

-

string http_build_uri(string url[, string proto[, string host[, int port]]])

-

Build a complete URI according to the supplied parameters.

-

If the url is already abolute but a different proto was supplied,
-only the proto part of the URI will be updated. If url has no
-path specified, the path of the current REQUEST_URI will be taken.
-The host will be taken either from the Host HTTP header of the client
-the SERVER_NAME or just localhost if prior are not available.
-If a port is pecified in either the url or as sperate parameter,
-it will be added if it differs from te default port for HTTP(S).

-

Returns the absolute URI as string.

-

Examples:


-<?php
$uri 
http_build_uri("page.php""https"NULL488);
?>
+

Accepts an optional unix timestamp as parameter.

+

Returns the HTTP date as string.

+

string http_build_url([mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]]])

+

Build an URL.

+

Expexts (part(s) of) an URL as first parameter in form of a string or assoziative array
+like parse_url() returns. Accepts an optional second parameter in the same way as the
+first argument. Accepts an optional third integer parameter, which is a bitmask of
+binary or'ed HTTP_URL_* constants. The optional fourth parameter will be filled
+with the results as associative array like parse_url() would return.

+

The parts of the second URL will be merged into the first according to the flags argument.
+The following flags are recognized:

	- HTTP_URL_REPLACE:        (default) set parts of the second url will replace the parts in the first
+ - HTTP_URL_JOIN_PATH: the path of the second url will be merged into the one of the first
+ - HTTP_URL_JOIN_QUERY: the two querystrings will be merged recursively
+ - HTTP_URL_STRIP_USER: the user part will not appear in the result
+ - HTTP_URL_STRIP_PASS: the password part will not appear in the result
+ - HTTP_URL_STRIP_AUTH: neither the user nor the password part will appear in the result
+ - HTTP_URL_STRIP_PORT: no explicit port will be set in the result
+ - HTTP_URL_STRIP_PATH: the path part will not appear in the result
+ - HTTP_URL_STRIP_QUERY: no query string will be present in the result
+ - HTTP_URL_STRIP_FRAGMENT: no fragment will be present in the result
+

+

Example:


+<?php
        
// ftp://ftp.example.com/pub/files/current/?a=b&a=c
        
echo http_build_url("http://user@www.example.com/pub/index.php?a=b#files",
            array(
                
"scheme" => "ftp",
                
"host"   => "ftp.example.com",
                
"path"   => "files/current/",
                
"query"  => "a=c"
            
),
            
HTTP_URL_STRIP_AUTH HTTP_URL_JOIN_PATH HTTP_URL_JOIN_QUERY HTTP_URL_STRIP_FRAGMENT
        
);
?>

-

+


+Returns the new URL as string on success or FALSE on failure.

+

string http_build_str(array query [, string prefix[, string arg_separator]])

+

Opponent to parse_str().

+

Expects an array as first argument which represents the parts of the query string to build.
+Accepts a string as optional second parameter containing a top-level prefix to use.
+The optional third parameter should specify an argument separator to use (by default the
+INI setting arg_separator.output will be used, or "&" if neither is set).

+

Returns the built query as string on success or FALSE on failure.

string http_negotiate_language(array supported[, array &result])

This function negotiates the clients preferred language based on its
Accept-Language HTTP header. The qualifier is recognized and languages
without qualifier are rated highest. The qualifier will be decreased by
10% for partial matches (i.e. matching primary language).

-

Expects an array as parameter cotaining the supported languages as values.
+

Expects an array as parameter containing the supported languages as values.
If the optional second parameter is supplied, it will be filled with an
array containing the negotiation results.

Returns the negotiated language or the default language (i.e. first array entry)
@@ -104,7 +123,7 @@ if none match.

This function negotiates the clients preferred charset based on its
Accept-Charset HTTP header. The qualifier is recognized and charsets
without qualifier are rated highest.

-

Expects an array as parameter cotaining the supported charsets as values.
+

Expects an array as parameter containing the supported charsets as values.
If the optional second parameter is supplied, it will be filled with an
array containing the negotiation results.

Returns the negotiated charset or the default charset (i.e. first array entry)
@@ -113,6 +132,19 @@ if none match.

<?php
$charsets 
= array(
        
'iso-8859-1'// default
        
'iso-8859-2',
        
'iso-8859-15',
        
'utf-8'
);

$pref http_negotiate_charset($charsets$result);

if (
strcmp($pref'iso-8859-1')) {
        
iconv_set_encoding('internal_encoding''iso-8859-1');
        
iconv_set_encoding('output_encoding'$pref);
        
ob_start('ob_iconv_handler');
}

print_r($result);
?>

+

string http_negotiate_ctype(array supported[, array &result])

+

This function negotiates the clients preferred content type based on its
+Accept HTTP header. The qualifier is recognized and content types
+without qualifier are rated highest.

+

Expects an array as parameter containing the supported content types as values.
+If the optional second parameter is supplied, it will be filled with an
+array containing the negotiation results.

+

Returns the negotiated content type or the default content type
+(i.e. first array entry) if none match.

+

Example:


+<?php
$ctypes 
= array('application/xhtml+xml''text/html');
http_send_content_type(http_negotiate_content_type($ctypes));
?>
+

+

bool http_send_status(int status)

Send HTTP status code.

Expects an HTTP status code as parameter.

@@ -133,7 +165,7 @@ if you use the http_send() API.

Send the Content-Disposition. The Content-Disposition header is very useful
if the data actually sent came from a file or something similar, that should
be "saved" by the client/user (i.e. by browsers "Save as..." popup window).

-

Expects a string parameter specifying the file name the "Save as..." dialogue
+

Expects a string parameter specifying the file name the "Save as..." dialog
should display. Optionally accepts a bool parameter, which, if set to true
and the user agent knows how to handle the content type, will probably not
cause the popup window to be shown.

@@ -153,7 +185,7 @@ else FALSE.

Expects a string parameter containing the ETag to compare. Optionally
accepts a bool parameter, which, if set to true, will check the header
usually used to validate HTTP ranges.

-

Retuns TRUE if ETag matches or the header contained the asterisk ("*"),
+

Returns TRUE if ETag matches or the header contained the asterisk ("*"),
else FALSE.

bool http_cache_last_modified([int timestamp_or_expires]])

Attempts to cache the sent entity by its last modification date.

@@ -166,24 +198,23 @@ requested last modification date is not between the calculated timespan,
the Last-Modified header is updated and the actual body will be sent.

Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.

A log entry will be written to the cache log if the INI entry
-http.cache_log is set and the cache attempt was successful.

+http.log.cache is set and the cache attempt was successful.

bool http_cache_etag([string etag])

Attempts to cache the sent entity by its ETag, either supplied or generated
-by the hash algorythm specified by the INI setting "http.etag_mode".

+by the hash algorithm specified by the INI setting "http.etag.mode".

If the clients "If-None-Match" header matches the supplied/calculated
ETag, the body is considered cached on the clients side and
a "304 Not Modified" status code is issued.

Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.

A log entry is written to the cache log if the INI entry
-"http.cache_log" is set and the cache attempt was successful.

+"http.log.cache" is set and the cache attempt was successful.

string ob_etaghandler(string data, int mode)

For use with ob_start(). Output buffer handler generating an ETag with
-the hash algorythm specified with the INI setting "http.etag_mode".

+the hash algorithm specified with the INI setting "http.etag.mode".

void http_throttle(double sec[, int bytes = 40960])

Sets the throttle delay and send buffer size for use with http_send() API.
Provides a basic throttling mechanism, which will yield the current process
resp. thread until the entity has been completely sent, though.

-

Note: This doesn't really work with the FastCGI SAPI.

Expects a double parameter specifying the seconds too sleep() after
each chunk sent. Additionally accepts an optional int parameter
representing the chunk size in bytes.

@@ -194,33 +225,35 @@ representing the chunk size in bytes.

void http_redirect([string url[, array params[, bool session = false[, int status = 302]]]])

Redirect to the given url.

-The supplied url will be expanded with http_build_uri(), the params array will
+The supplied url will be expanded with http_build_url(), the params array will
be treated with http_build_query() and the session identification will be appended
if session is true.

The HTTP response code will be set according to status.
You can use one of the following constants for convenience:
- - HTTP_REDIRECT 302 Found
+ - HTTP_REDIRECT 302 Found for GET/HEAD, else 303 See Other
- HTTP_REDIRECT_PERM 301 Moved Permanently
+ - HTTP_REDIRECT_FOUND 302 Found
- HTTP_REDIRECT_POST 303 See Other
+ - HTTP_REDIRECT_PROXY 305 Use Proxy
- HTTP_REDIRECT_TEMP 307 Temporary Redirect

Please see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
for which redirect response code to use in which situation.

-

To be RFC compliant, "Redirecting to URI." will be displayed,
-if the client doesn't redirect immediatly, and the request method was
+

To be RFC compliant, "Redirecting to URL." will be displayed,
+if the client doesn't redirect immediately, and the request method was
another one than HEAD.

Returns FALSE on failure, or *exits* on success.

A log entry will be written to the redirect log, if the INI entry
-"http.redirect_log" is set and the redirect attempt was successful.

+"http.log.redirect" is set and the redirect attempt was successful.

bool http_send_data(string data)

Sends raw data with support for (multiple) range requests.

-

Retursn TRUE on success, or FALSE on failure.

+

Returns TRUE on success, or FALSE on failure.

bool http_send_file(string file)

Sends a file with support for (multiple) range requests.

Expects a string parameter referencing the file to send.

Returns TRUE on success, or FALSE on failure.

bool http_send_stream(resource stream)

Sends an already opened stream with support for (multiple) range requests.

-

Expects a resource parameter referncing the stream to read from.

+

Expects a resource parameter referencing the stream to read from.

Returns TRUE on success, or FALSE on failure.

string http_chunked_decode(string encoded)

Decodes a string that was HTTP-chunked encoded.

@@ -230,7 +263,7 @@ another one than HEAD.

Parses (a) http_message(s) into a simple recursive object structure.

Expects a string parameter containing a single HTTP message or
several consecutive HTTP messages.

-

Returns an hierachical object structure of the parsed messages.

+

Returns an hierarchical object structure of the parsed messages.

Example:


<?php
print_r
(http_parse_message(http_get(URL, array('redirect' => 3)));

stdClass object
(
    [
type] => 2
    
[httpVersion] => 1.1
    
[responseCode] => 200
    
[headers] => Array 
        (
            [
Content-Length] => 3
            
[Server] => Apache
        
)
    [
body]  => Hi!
    [
parentMessage] => stdClass object
    
(
        [
type] => 2
        
[httpVersion] => 1.1
        
[responseCode] => 302
        
[headers] => Array 
            (
                [
Content-Length] => 0
                
[Location] => ...
            )
        [
body]  => 
        [
parentMessage] => ...
    )
)
?>

@@ -240,15 +273,31 @@ several consecutive HTTP messages.

Expects a string parameter containing HTTP headers.

Returns an array on success, or FALSE on failure.

Example:


-<?php
$headers 
"content-type: text/html; charset=UTF-8\r\n".
           
"Server: Funky/1.0\r\n".
           
"Set-Cookie: foo=bar\r\n".
           
"Set-Cookie: baz=quux\r\n".
           
"Folded: works\r\n\ttoo\r\n";
print_r(http_parse_headers($headers));

Array
(
    [
Content-Type] => text/htmlchatset=UTF-8
    
[Server] => Funky/1.0
    
[Set-Cookie] => Array
        (
            [
0] => foo=bar
            
[1] => baz=quux
        
)
    [
Folded] => works
        too 
?>

+<?php
$headers 
"content-type: text/html; charset=UTF-8\r\n".
           
"Server: Funky/1.0\r\n".
           
"Set-Cookie: foo=bar\r\n".
           
"Set-Cookie: baz=quux\r\n".
           
"Folded: works\r\n\ttoo\r\n";
print_r(http_parse_headers($headers));

Array
(
    [
Content-Type] => text/htmlchatset=UTF-8
    
[Server] => Funky/1.0
    
[Set-Cookie] => Array
        (
            [
0] => foo=bar
            
[1] => baz=quux
        
)
    [
Folded] => works
        too 

?>
+

+

+ +

Parses HTTP cookies like sent in a response into a struct.

+

Expects a string as parameter containing the value of a Set-Cookie response header.

+

Returns an stdClass olike shown in the example on success or FALSE on failure.

+

Example:


+<?php
print_r
(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure"0, array("comment")));

stdClass Object
(
    [
cookies] => Array
        (
            [
foo] => bar
            
[bar] => baz
        
)

    [
extras] => Array
        (
            [
comment] =>
        )

    [
flags] => 16
    
[expires] => 0
    
[path] => /
    [
domain] => example.com
)
?>

+

object http_parse_params(string param[, int flags = HTTP_PARAMS_DEFAULT])

+

Parse parameter list.

array http_get_request_headers(void)

Get a list of incoming HTTP headers.

Returns an associative array of incoming request headers.

string http_get_request_body(void)

Get the raw request body (e.g. POST or PUT data).

-

Returns NULL when using the CLI SAPI.

+

This function can not be used after http_get_request_body_stream()
+if the request method was another than POST.

+

Returns the raw request body as string on success or NULL on failure.

+

resource http_get_request_body_stream(void)

+

Create a stream to read the raw request body (e.g. POST or PUT data).

+

This function can only be used once if the request method was another than POST.

+

Returns the raw request body as stream on success or NULL on failure.

bool http_match_request_header(string header, string value[, bool match_case = false])

Match an incoming HTTP header.

Expects two string parameters representing the header name (case-insensitive)
@@ -263,12 +312,12 @@ array where the following keys will be recognized:

 - redirect:
                      redirects to a different host
- proxyhost: string, proxy host in "host[:port]" format
- proxyport: int, use another proxy port as specified in proxyhost
+ - proxytype: int, HTTP_PROXY_HTTP, SOCKS4 or SOCKS5
- proxyauth: string, proxy credentials in "user:pass" format
- proxyauthtype: int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM
- httpauth: string, http credentials in "user:pass" format
- httpauthtype: int, HTTP_AUTH_BASIC, DIGEST and/or NTLM
- compress: bool, whether to allow gzip/deflate content encoding
- (defaults to true)
- port: int, use another port as specified in the url
- referer: string, the referer to send
- useragent: string, the user agent to send
@@ -277,19 +326,43 @@ array where the following keys will be recognized:

 - redirect:
                      like array("header" => "value")
- cookies: array, list of cookies as associative array
like array("cookie" => "value")
+ - encodecookies: bool, whether to urlencode the cookies (default: true)
- cookiestore: string, path to a file where cookies are/will be stored
+ - cookiesession: bool, don't load session cookies from cookiestore if TRUE
- resume: int, byte offset to start the download from;
if the server supports ranges
+ - range: array, array of arrays, each containing two integers,
+ specifying the ranges to download if server support is
+ given; only recognized if the resume option is empty
- maxfilesize: int, maximum file size that should be downloaded;
has no effect, if the size of the requested entity is not known
- lastmodified: int, timestamp for If-(Un)Modified-Since header
+ - etag: string, quoted etag for If-(None-)Match header
- timeout: int, seconds the request may take
- connecttimeout: int, seconds the connect may take
- onprogress: mixed, progress callback
+ - interface: string, outgoing network interface (ifname, ip or hostname)
+ - portrange: array, 2 integers specifying outgoing portrange to try
+ - ssl: array, with the following options:
+ cert: string, path to certificate
+ certtype: string, type of certificate
+ certpasswd: string, password for certificate
+ key: string, path to key
+ keytype: string, type of key
+ keypasswd: string, pasword for key
+ engine: string, ssl engine to use
+ version: int, ssl version to use
+ verifypeer: bool, whether to verify the peer
+ verifyhost: bool whether to verify the host
+ cipher_list: string, list of allowed ciphers
+ cainfo: string
+ capath: string
+ random_file: string
+ egdsocket: string

The optional third parameter will be filled with some additional information
-in form af an associative array, if supplied, like the following example:


-<?php
array (
    
'effective_url' => 'http://localhost',
    
'response_code' => 403,
    
'total_time' => 0.017,
    
'namelookup_time' => 0.013,
    
'connect_time' => 0.014,
    
'pretransfer_time' => 0.014,
    
'size_upload' => 0,
    
'size_download' => 202,
    
'speed_download' => 11882,
    
'speed_upload' => 0,
    
'header_size' => 145,
    
'request_size' => 62,
    
'ssl_verifyresult' => 0,
    
'filetime' => -1,
    
'content_length_download' => 202,
    
'content_length_upload' => 0,
    
'starttransfer_time' => 0.017,
    
'content_type' => 'text/html; charset=iso-8859-1',
    
'redirect_time' => 0,
    
'redirect_count' => 0,
    
'http_connectcode' => 0,
    
'httpauth_avail' => 0,
    
'proxyauth_avail' => 0,
)
?>
+in form of an associative array, if supplied, like the following example:


+<?php
array (
   
'effective_url' => 'http://www.example.com/',
   
'response_code' => 302,
   
'connect_code' => 0,
   
'filetime' => -1,
   
'total_time' => 0.212348,
   
'namelookup_time' => 0.038296,
   
'connect_time' => 0.104144,
   
'pretransfer_time' => 0.104307,
   
'starttransfer_time' => 0.212077,
   
'redirect_time' => 0,
   
'redirect_count' => 0,
   
'size_upload' => 0,
   
'size_download' => 218,
   
'speed_download' => 1026,
   
'speed_upload' => 0,
   
'header_size' => 307,
   
'request_size' => 103,
   
'ssl_verifyresult' => 0,
   
'ssl_engines' =>
   array (
     
=> 'dynamic',
     
=> 'cswift',
     
=> 'chil',
     
=> 'atalla',
     
=> 'nuron',
     
=> 'ubsec',
     
=> 'aep',
     
=> 'sureware',
     
=> '4758cca',
   ),
   
'content_length_download' => 218,
   
'content_length_upload' => 0,
   
'content_type' => 'text/html',
   
'httpauth_avail' => 0,
   
'proxyauth_avail' => 0,
   
'num_connects' => 1,
   
'os_errno' => 0,
   
'error' => '',
 )
?>

Returns the HTTP response(s) as string on success, or FALSE on failure.

@@ -298,19 +371,19 @@ in form af an associative array, if supplied, like the following example:

See http_get() for a full list of available parameters and options.

Returns the HTTP response as string on success, or FALSE on failure.

string http_post_data(string url, string data[, array options[, array &info]])

-

Performs an HTTP POST requeston the supplied url.

+

Performs an HTTP POST request on the supplied url.

Expects a string as second parameter containing the pre-encoded post data.
See http_get() for a full list of available parameters and options.

Returns the HTTP response(s) as string on success, or FALSE on failure.

string http_post_fields(string url, array data[, array files[, array options[, array &info]]])

Performs an HTTP POST request on the supplied url.

-

Expecrs an associative array as second parameter, which will be
+

Expects an associative array as second parameter, which will be
www-form-urlencoded. See http_get() for a full list of available options.

Returns the HTTP response(s) as string on success, or FALSE on failure.

string http_put_file(string url, string file[, array options[, array &info]])

Performs an HTTP PUT request on the supplied url.

-

Expects the second parameter to be a string referncing the file to upload.
+

Expects the second parameter to be a string referencing the file to upload.
See http_get() for a full list of available options.

Returns the HTTP response(s) as string on success, or FALSE on failure.

string http_put_stream(string url, resource stream[, array options[, array &info]])

@@ -318,7 +391,21 @@ See http_get() for a full list of available options.

Expects the second parameter to be a resource referencing an already
opened stream, from which the data to upload should be read.
See http_get() for a full list of available options.

-

Returns the HTTP response(s) as string on success. or FALSE on failure.

+

Returns the HTTP response(s) as string on success, or FALSE on failure.

+

string http_put_data(string url, string data[, array options[, array &info]])

+

Performs an HTTP PUT request on the supplied url.

+

Expects the second parameter to be a string containing the data to upload.
+See http_get() for a full list of available options.

+

Returns the HTTP response(s) as string on success, or FALSE on failure.

+

string http_request(int method, string url[, string body[, array options[, array &info]]])

+

Performs a custom HTTP request on the supplied url.

+

Expects the first parameter to be an integer specifying the request method to use.
+Accepts an optional third string parameter containing the raw request body.
+See http_get() for a full list of available options.

+

Returns the HTTP response(s) as string on success, or FALSE on failure.

+

string http_request_body_encode(array fields, array files)

+

Generate x-www-form-urlencoded resp. form-data encoded request body.

+

Returns encoded string on success, or FALSE on failure.

int http_request_method_register(string method)

Register a custom request method.

Expects a string parameter containing the request method name to register.

@@ -335,44 +422,26 @@ See http_get() for a full list of available options.

Get the literal string representation of a standard or registered request method.

Expects the request method ID as parameter.

Returns the request method name as string on success, or FALSE on failure.

-

string http_build_query(mixed formdata [, string prefix[, string arg_separator]])

-

Generates a form-encoded query string from an associative array or object.

-

string http_gzencode(string data[, int level = -1])

-

Compress data with the HTTP compatible GZIP encoding.

-

Expects the first parameter to be a string which contains the data that
-should be encoded. Additionally accepts an optional in paramter specifying
-the compression level, where -1 is default, 0 is no compression and 9 is
-best compression ratio.

-

Returns the encoded string on success, or NULL on failure.

-

string http_gzdecode(string data)

-

Uncompress data compressed with the HTTP compatible GZIP encoding.

-

Expects a string as parameter containing the compressed data.

-

Returns the decoded string on success, or NULL on failure.

-

string http_deflate(string data[, int level = -1])

-

Compress data with the HTTP compatible DEFLATE encoding.

+

string http_deflate(string data[, int flags = 0])

+

Compress data with gzip, zlib AKA deflate or raw deflate encoding.

Expects the first parameter to be a string containing the data that should
-be encoded. Additionally accepts an optional int parameter specifying the
-compression level, where -1 is default, 0 is no compression and 9 is best
-compression ratio.

+be encoded.

Returns the encoded string on success, or NULL on failure.

string http_inflate(string data)

-

Uncompress data compressed with the HTTP compatible DEFLATE encoding.

-

Expects a string as parameter containing the compressed data.

-

Returns the decoded string on success, or NULL on failure.

-

string http_compress(string data[, int level = -1])

-

Compress data with the HTTP compatible COMPRESS encoding.

-

Expects the first parameter to be a string containing the data which should
-be encoded. Additionally accepts an optional int parameter specifying the
-compression level, where -1 is default, 0 is no compression and 9 is best
-compression ratio.

-

Returns the encoded string on success, or NULL on failure.

-

string http_uncompress(string data)

-

Uncompress data compressed with the HTTP compatible COMPRESS encoding.

+

Decompress data compressed with either gzip, deflate AKA zlib or raw
+deflate encoding.

Expects a string as parameter containing the compressed data.

Returns the decoded string on success, or NULL on failure.

+

string ob_deflatehandler(string data, int mode)

+

For use with ob_start(). The deflate output buffer handler can only be used once.
+It conflicts with ob_gzhandler and zlib.output_compression as well and should
+not be used after ext/mbstrings mb_output_handler and ext/sessions URL-Rewriter (AKA
+session.use_trans_sid).

+

string ob_inflatehandler(string data, int mode)

+

For use with ob_start(). Same restrictions as with ob_deflatehandler apply.

int http_support([int feature = 0])

Check for feature that require external libraries.

-

Accpepts an optional in parameter specifying which feature to probe for.
+

Accepts an optional in parameter specifying which feature to probe for.
If the parameter is 0 or omitted, the return value contains a bitmask of
all supported features that depend on external libraries.

Available features to probe for are:
@@ -384,14 +453,44 @@ all supported features that depend on external libraries.

and SSL requests can be issued
  • HTTP_SUPPORT_ENCODINGS: whether ext/http was linked against zlib,
    and compressed HTTP responses can be decoded
    -
  • HTTP_SUPPORT_MHASHETAGS: whether ext/http was linked against libmhash,
    - and ETags can be generated with the available mhash algorithms
  • HTTP_SUPPORT_MAGICMIME: whether ext/http was linked against libmagic,
    and the HttpResponse::guessContentType() method is usable

    Returns int, whether requested feature is supported, or a bitmask with
    all supported features.


    +

    http_deflatestream_object.c

    +

    HttpDeflateStream

    +

    void HttpDeflateStream::__construct([int flags = 0])

    +

    Creates a new HttpDeflateStream object instance.

    +

    Accepts an optional int parameter specifying how to initialize the deflate stream.

    +

    string HttpDeflateStream::update(string data)

    +

    Passes more data through the deflate stream.

    +

    Expects a string parameter containing (a part of) the data to deflate.

    +

    Returns deflated data on success or FALSE on failure.

    +

    string HttpDeflateStream::flush([string data])

    +

    Flushes the deflate stream.

    +

    Returns some deflated data as string on success or FALSE on failure.

    +

    string HttpDeflateStream::finish([string data])

    +

    Finalizes the deflate stream. The deflate stream can be reused after finalizing.

    +

    Returns the final part of deflated data.

    +
    +

    http_inflatestream_object.c

    +

    HttpInflateStream

    +

    void HttpInflateStream::__construct([int flags = 0])

    +

    Creates a new HttpInflateStream object instance.

    +

    Accepts an optional int parameter specifying how to initialize the inflate stream.

    +

    string HttpInflateStream::update(string data)

    +

    Passes more data through the inflate stream.

    +

    Expects a string parameter containing (a part of) the data to inflate.

    +

    Returns inflated data on success or FALSE on failure.

    +

    string HttpInflateStream::flush([string data])

    +

    Flush the inflate stream.

    +

    Returns some inflated data as string on success or FALSE on failure.

    +

    string HttpInflateStream::finish([string data])

    +

    Finalizes the inflate stream. The inflate stream can be reused after finalizing.

    +

    Returns the final part of inflated data.

    +

    http_message_object.c

    HttpMessage

    void HttpMessage::__construct([string message])

    @@ -401,10 +500,10 @@ consecutive HTTP messages. The constructed object will actually
    represent the *last* message of the passed string. If there were
    prior messages, those can be accessed by HttpMessage::getParentMessage().

    Throws HttpMalformedHeaderException.

    -

    static HttpMessage HttpMessage::fromString(string raw_message)

    +

    static HttpMessage HttpMessage::fromString(string raw_message[, string class_name = "HttpMessage"])

    Create an HttpMessage object from a string. Kind of a static constructor.

    -

    Expects a string parameter containing a sinlge or several consecutive
    -HTTP messages.

    +

    Expects a string parameter containing a single or several consecutive
    +HTTP messages. Accepts an optional string parameter specifying the class to use.

    Returns an HttpMessage object on success or NULL on failure.

    Throws HttpMalformedHeadersException.

    string HttpMessage::getBody()

    @@ -414,6 +513,9 @@ HTTP messages.

    Set the body of the HttpMessage.
    NOTE: Don't forget to update any headers accordingly.

    Expects a string parameter containing the new body of the message.

    +

    string HttpMessage::getHeader(string header)

    +

    Get message header.

    +

    Returns the header value on success or NULL if the header does not exist.

    array HttpMessage::getHeaders()

    Get Message Headers.

    Returns an associative array containing the messages HTTP headers.

    @@ -433,7 +535,7 @@ it will be overwritten with the new header value.

    Returns the HttpMessage::TYPE.

    void HttpMessage::setType(int type)

    Set Message Type. (HTTP_MSG_NONE|HTTP_MSG_REQUEST|HTTP_MSG_RESPONSE)

    -

    Exptects an int parameter, the HttpMessage::TYPE.

    +

    Expects an int parameter, the HttpMessage::TYPE.

    int HttpMessage::getResponseCode()

    Get the Response Code of the Message.

    Returns the HTTP response code if the message is of type
    @@ -443,6 +545,15 @@ HttpMessage::TYPE_RESPONSE, else FALSE.

    Expects an int parameter with the HTTP response code.

    Returns TRUE on success, or FALSE if the message is not of type
    HttpMessage::TYPE_RESPONSE or the response code is out of range (100-510).

    +

    string HttpMessage::getResponseStatus()

    +

    Get the Response Status of the message (i.e. the string following the response code).

    +

    Returns the HTTP response status string if the message is of type
    +HttpMessage::TYPE_RESPONSE, else FALSE.

    +

    bool HttpMessage::setResponseStatus(string status)

    +

    Set the Response Status of the HTTP message (i.e. the string following the response code).

    +

    Expects a string parameter containing the response status text.

    +

    Returns TRUE on success or FALSE if the message is not of type
    +HttpMessage::TYPE_RESPONSE.

    string HttpMessage::getRequestMethod()

    Get the Request Method of the Message.

    Returns the request method name on success, or FALSE if the message is
    @@ -452,15 +563,15 @@ not of type HttpMessage::TYPE_REQUEST.

    Expects a string parameter containing the request method name.

    Returns TRUE on success, or FALSE if the message is not of type
    HttpMessage::TYPE_REQUEST or an invalid request method was supplied.

    -

    string HttpMessage::getRequestUri()

    -

    Get the Request URI of the Message.

    -

    Returns the request uri as string on success, or FALSE if the message
    +

    string HttpMessage::getRequestUrl()

    +

    Get the Request URL of the Message.

    +

    Returns the request url as string on success, or FALSE if the message
    is not of type HttpMessage::TYPE_REQUEST.

    -

    bool HttpMessage::setRequestUri(string URI)

    -

    Set the Request URI of the HTTP Message.

    -

    Expects a string parameters containing the request uri.

    +

    bool HttpMessage::setRequestUrl(string url)

    +

    Set the Request URL of the HTTP Message.

    +

    Expects a string parameters containing the request url.

    Returns TRUE on success, or FALSE if the message is not of type
    -HttpMessage::TYPE_REQUEST or supplied URI was empty.

    +HttpMessage::TYPE_REQUEST or supplied URL was empty.

    string HttpMessage::getHttpVersion()

    Get the HTTP Protocol Version of the Message.

    Returns the HTTP protocol version as string.

    @@ -468,9 +579,17 @@ HttpMessage::TYPE_REQUEST or supplied URI was empty.

    Set the HTTP Protocol version of the Message.

    Expects a string parameter containing the HTTP protocol version.

    Returns TRUE on success, or FALSE if supplied version is out of range (1.0/1.1).

    +

    string HttpMessage::guessContentType(string magic_file[, int magic_mode = MAGIC_MIME])

    +

    Attempts to guess the content type of supplied payload through libmagic.

    +

    Expects a string parameter specifying the magic.mime database to use.
    +Additionally accepts an optional int parameter, being flags for libmagic.

    +

    Returns the guessed content type on success, or FALSE on failure.

    +

    Throws HttpRuntimeException, HttpInvalidParamException
    +if http.only_exceptions is TRUE.

    HttpMessage HttpMessage::getParentMessage()

    Get parent Message.

    Returns the parent HttpMessage on success, or NULL if there's none.

    +

    Throws HttpRuntimeException.

    bool HttpMessage::send()

    Send the Message according to its type as Response or Request.
    This provides limited functionality compared to HttpRequest and HttpResponse.

    @@ -480,23 +599,93 @@ This provides limited functionality compared to HttpRequest and HttpResponse.

    Accepts a bool parameter which specifies whether the returned string
    should also contain any parent messages.

    Returns the full message as string.

    +

    HttpRequest|HttpResponse HttpMessage::toMessageTypeObject(void)

    +

    Creates an object regarding to the type of the message.

    +

    Returns either an HttpRequest or HttpResponse object on success, or NULL on failure.

    +

    Throws HttpRuntimeException, HttpMessageTypeException, HttpHeaderException.

    +

    int HttpMessage::count()

    +

    Implements Countable.

    +

    Returns the number of parent messages + 1.

    +

    string HttpMessage::serialize()

    +

    Implements Serializable.

    +

    Returns the serialized representation of the HttpMessage.

    +

    void HttpMessage::unserialize(string serialized)

    +

    Implements Serializable.

    +

    Re-constructs the HttpMessage based upon the serialized string.

    +

    HttpMessage HttpMessage::detach(void)

    +

    Returns a clone of an HttpMessage object detached from any parent messages.

    +

    void HttpMessage::prepend(HttpMessage message[, bool top = true])

    +

    Prepends message(s) to the HTTP message.

    +

    Expects an HttpMessage object as parameter.

    +

    Throws HttpInvalidParamException if the message is located within the same message chain.

    +

    HttpMessage HttpMessage::reverse()

    +

    Reorders the message chain in reverse order.

    +

    Returns the most parent HttpMessage object.

    +

    void HttpMessage::rewind(void)

    +

    Implements Iterator.

    +

    bool HttpMessage::valid(void)

    +

    Implements Iterator.

    +

    void HttpMessage::next(void)

    +

    Implements Iterator.

    +

    int HttpMessage::key(void)

    +

    Implements Iterator.

    +

    HttpMessage HttpMessage::current(void)

    +

    Implements Iterator.

    +
    +

    http_querystring_object.c

    +

    HttpQueryString

    +

    final void HttpQueryString::__construct([bool global = true[, mixed add])

    +

    Creates a new HttpQueryString object instance.
    +Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.

    +

    string HttpQueryString::toString()

    +

    Returns the string representation.

    +

    array HttpQueryString::toArray()

    +

    Returns the array representation.

    +

    mixed HttpQueryString::get([string key[, mixed type = 0[, mixed defval = NULL[, bool delete = false]]]])

    +

    Get (part of) the query string.

    +

    The type parameter is either one of the HttpQueryString::TYPE_* constants or a type abbreviation like
    +"b" for bool, "i" for int, "f" for float, "s" for string, "a" for array and "o" for a stdClass object.

    +

    string HttpQueryString::set(mixed params)

    +

    Set query string entry/entries. NULL values will unset the variable.

    +

    HttpQueryString HttpQueryString::mod(mixed params)

    +

    Copies the query string object and sets provided params at the clone.
    +This is basically shorthand for:


    +<?php
    $newQS 
    = new HttpQueryString(false$oldQS);
    $newQS->set($other_params);
    ?>
    +

    +

    +

    static HttpQueryString HttpQueryString::singleton([bool global = true])

    +

    Get a single instance (differentiates between the global setting).

    +

    bool HttpQueryString::xlate(string ie, string oe)

    +

    Converts the query string from the source encoding ie to the target encoding oe.
    +WARNING: Don't use any character set that can contain NUL bytes like UTF-16.

    +

    Returns TRUE on success or FALSE on failure.

    +

    string HttpQueryString::serialize()

    +

    Implements Serializable.

    +

    void HttpQueryString::unserialize(string serialized)

    +

    Implements Serializable.

    +

    mixed HttpQueryString::offsetGet(string offset)

    +

    Implements ArrayAccess.

    +

    void HttpQueryString::offsetSet(string offset, mixed value)

    +

    Implements ArrayAccess.

    +

    bool HttpQueryString::offsetExists(string offset)

    +

    Implements ArrayAccess.

    +

    void HttpQueryString::offsetUnset(string offset)

    +

    Implements ArrayAccess.


    http_request_object.c

    HttpRequest

    void HttpRequest::__construct([string url[, int request_method = HTTP_METH_GET[, array options]]])

    Instantiate a new HttpRequest object.

    Accepts a string as optional parameter containing the target request url.
    -Additianally accepts an optional int parameter specifying the request method
    +Additionally accepts an optional int parameter specifying the request method
    to use and an associative array as optional third parameter which will be
    passed to HttpRequest::setOptions().

    Throws HttpException.

    -

    void HttpRequest::__destruct()

    -

    Destroys the HttpRequest object.

    bool HttpRequest::setOptions([array options])

    Set the request options to use. See http_get() for a full list of available options.

    -

    Accepts an array as optional parameters, wich values will overwrite the
    -currently set request options. If the parameter is empty or mitted,
    -the optoions of the HttpRequest object will be reset.

    +

    Accepts an array as optional parameters, which values will overwrite the
    +currently set request options. If the parameter is empty or omitted,
    +the options of the HttpRequest object will be reset.

    Returns TRUE on success, or FALSE on failure.

    array HttpRequest::getOptions()

    Get currently set options.

    @@ -515,7 +704,7 @@ If the parameter is empty or omitted, the SSL options will be reset.

    Returns an associative array containing any previously set SSL options.

    bool HttpRequest::addHeaders(array headers)

    Add request header name/value pairs.

    -

    Expects an ssociative array as parameter containing additional header
    +

    Expects an associative array as parameter containing additional header
    name/value pairs.

    Returns TRUE on success, or FALSE on failure.

    bool HttpRequest::setHeaders([array headers])

    @@ -539,6 +728,16 @@ pairs to add.

    array HttpRequest::getCookies()

    Get previously set cookies.

    Returns an associative array containing any previously set cookies.

    +

    bool HttpRequest::enableCookies()

    +

    Enable automatic sending of received cookies.
    +Note that cuutomly set cookies will be sent anyway.

    +

    bool HttpRequest::resetCookies([bool session_only = FALSE])

    +

    Reset all automatically received/sent cookies.
    +Note that customly set cookies are not affected.

    +

    Accepts an optional bool parameter specifying
    +whether only session cookies should be reset
    +(needs libcurl >= v7.15.4, else libcurl >= v7.14.1).

    +

    Returns TRUE on success, or FALSE on failure.

    bool HttpRequest::setUrl(string url)

    Set the request URL.

    Expects a string as parameter specifying the request url.

    @@ -549,7 +748,7 @@ pairs to add.

    bool HttpRequest::setMethod(int request_method)

    Set the request method.

    Expects an int as parameter specifying the request method to use.
    -In PHP 5.1+ HttpRequest::METH, otherwise the HTTP_METH constants can be used.

    +In PHP 5.1+ HttpRequest::METH_*, otherwise the HTTP_METH_* constants can be used.

    Returns TRUE on success, or FALSE on failure.

    int HttpRequest::getMethod()

    Get the previously set request method.

    @@ -610,11 +809,11 @@ Affects only POST and custom requests.

    Get previously set raw post data.

    Returns a string containing the currently set raw post data.

    bool HttpRequest::addPostFile(string name, string file[, string content_type = "application/x-octetstream"])

    -

    Add a file to the POST request, leaving prefiously set files unchanged.
    +

    Add a file to the POST request, leaving previously set files unchanged.
    Affects only POST and custom requests. Cannot be used with raw post data.

    Expects a string parameter containing the form element name, and a string
    paremeter containing the path to the file which should be uploaded.
    -Additionally accepts an optional string parameter which chould contain
    +Additionally accepts an optional string parameter which should contain
    the content type of the file.

    Returns TRUE on success, or FALSE if the content type seems not to contain a
    primary and a secondary content type part.

    @@ -636,10 +835,26 @@ If the parameter is empty or omitted the put file will be unset.

    string HttpRequest::getPutFile()

    Get previously set put file.

    Returns a string containing the path to the currently set put file.

    +

    bool HttpRequest::setPutData([string put_data])

    +

    Set PUT data to send, overwriting previously set PUT data.
    +Affects only PUT requests.
    +Only either PUT data or PUT file can be used for each request.
    +PUT data has higher precedence and will be used even if a PUT
    +file is set.

    +

    Accepts a string as parameter containing the data to upload.

    +

    Returns TRUE on success, or FALSE on failure.

    +

    bool HttpRequest::addPutData(string put_data)

    +

    Add PUT data, leaving previously set PUT data unchanged.
    +Affects only PUT requests.

    +

    Expects a string as parameter containing the data to concatenate.

    +

    Returns TRUE on success, or FALSE on failure.

    +

    string HttpRequest::getPutData()

    +

    Get previously set PUT data.

    +

    Returns a string containing the currently set raw post data.

    array HttpRequest::getResponseData()

    Get all response data after the request has been sent.

    Returns an associative array with the key "headers" containing an associative
    -array holding all response headers, as well as the ley "body" containing a
    +array holding all response headers, as well as the key "body" containing a
    string with the response body.

    If redirects were allowed and several responses were received, the data
    references the last received response.

    @@ -648,17 +863,12 @@ references the last received response.

    Accepts an string as optional parameter specifying a certain header to read.
    If the parameter is empty or omitted all response headers will be returned.

    Returns either a string with the value of the header matching name if requested,
    -FALSE on failure, or an associative array containing all reponse headers.

    +FALSE on failure, or an associative array containing all response headers.

    If redirects were allowed and several responses were received, the data
    references the last received response.

    -

    array HttpRequest::getResponseCookie([string name])

    +

    array HttpRequest::getResponseCookies([int flags[, array allowed_extras]])

    Get response cookie(s) after the request has been sent.

    -

    Accepts a string as optional parameter specifying the name of the cookie to read.
    -If the parameter is empty or omitted, an associative array with all received
    -cookies will be returned.

    -

    Returns either an associative array with the cookie's name, value and any
    -additional params of the cookie matching name if requested, FALSE on failure,
    -or an array containing all received cookies as arrays.

    +

    Returns an array of stdClass objects like http_parse_cookie would return.

    If redirects were allowed and several responses were received, the data
    references the last received response.

    string HttpRequest::getResponseBody()

    @@ -671,6 +881,9 @@ references the last received response.

    Returns an int representing the response code.

    If redirects were allowed and several responses were received, the data
    references the last received response.

    +

    string HttpRequest::getResponseStatus()

    +

    Get the response status (i.e. the string after the response code) after the message has been sent.

    +

    Returns a string containing the response status text.

    mixed HttpRequest::getResponseInfo([string name])

    Get response info after the request has been sent.
    See http_get() for a full list of returned info.

    @@ -687,38 +900,52 @@ references the last received response.

    Returns an HttpMessage object of the response.

    If redirects were allowed and several responses were received, the data
    references the last received response. Use HttpMessage::getParentMessage()
    -to access the data of previously received responses whithin this request
    +to access the data of previously received responses within this request
    cycle.

    -

    Throws HttpException.

    +

    Throws HttpException, HttpRuntimeException.

    HttpMessage HttpRequest::getRequestMessage()

    Get sent HTTP message.

    Returns an HttpMessage object representing the sent request.

    If redirects were allowed and several responses were received, the data
    references the last received response. Use HttpMessage::getParentMessage()
    -to access the data of previously sent requests whithin this request
    +to access the data of previously sent requests within this request
    cycle.

    +

    Note that the internal request message is immutable, that means that the
    +request message received through HttpRequest::getRequestMessage() will
    +always look the same for the same request, regardless of any changes you
    +may have made to the returned object.

    +

    Throws HttpMalformedHeadersException, HttpEncodingException.

    +

    string HttpRequest::getRawRequestMessage()

    +

    Get sent HTTP message.

    +

    Returns an HttpMessage in a form of a string

    +

    string HttpRequest::getRawResponseMessage()

    +

    Get the entire HTTP response.

    +

    Returns the complete web server response, including the headers in a form of a string.

    HttpMessage HttpRequest::getHistory()

    Get all sent requests and received responses as an HttpMessage object.

    -

    If you don't want to record history at all, set the instance variable
    -HttpRequest::$recoedHistory to FALSE.

    +

    If you want to record history, set the instance variable
    +HttpRequest::$recordHistory to TRUE.

    Returns an HttpMessage object representing the complete request/response
    history.

    The object references the last received response, use HttpMessage::getParentMessage()
    to access the data of previously sent requests and received responses.

    -

    Throws HttpMalformedHeaderException.

    +

    Throws HttpRuntimeException.

    void HttpRequest::clearHistory()

    Clear the history.

    HttpMessage HttpRequest::send()

    Send the HTTP request.

    Returns the received response as HttpMessage object.

    +

    NOTE: While an exception may be thrown, the transfer could have succeeded
    +at least partially, so you might want to check the return values of various
    +HttpRequest::getResponse*() methods.

    Throws HttpRuntimeException, HttpRequestException,
    HttpMalformedHeaderException, HttpEncodingException.

    GET example:


    -<?php
    $r 
    = new HttpRequest('http://example.com/feed.rss'HTTP_GET);
    $r->setOptions(array('lastmodified' => filemtime('local.rss')));
    $r->addQueryData(array('category' => 3));
    try {
        
    $r->send();
        if (
    $r->getResponseCode() == 200) {
            
    file_put_contents('local.rss'$r->getResponseBody());
       }
    } catch (
    HttpException $ex) {
        echo 
    $ex;
    }
    ?>
    +<?php
    $r 
    = new HttpRequest('http://example.com/feed.rss'HttpRequest::METH_GET);
    $r->setOptions(array('lastmodified' => filemtime('local.rss')));
    $r->addQueryData(array('category' => 3));
    try {
        
    $r->send();
        if (
    $r->getResponseCode() == 200) {
            
    file_put_contents('local.rss'$r->getResponseBody());
       }
    } catch (
    HttpException $ex) {
        echo 
    $ex;
    }
    ?>

    POST example:


    -<?php
    $r 
    = new HttpRequest('http://example.com/form.php'HTTP_POST);
    $r->setOptions(array('cookies' => array('lang' => 'de')));
    $r->addPostFields(array('user' => 'mike''pass' => 's3c|r3t'));
    $r->addPostFile('image''profile.jpg''image/jpeg');
    try {
        echo 
    $r->send()->getBody();
    } catch (
    HttpException $ex) {
        echo 
    $ex;
    }
    ?>
    +<?php
    $r 
    = new HttpRequest('http://example.com/form.php'HttpRequest::METH_POST);
    $r->setOptions(array('cookies' => array('lang' => 'de')));
    $r->addPostFields(array('user' => 'mike''pass' => 's3c|r3t'));
    $r->addPostFile('image''profile.jpg''image/jpeg');
    try {
        echo 
    $r->send()->getBody();
    } catch (
    HttpException $ex) {
        echo 
    $ex;
    }
    ?>


    @@ -728,10 +955,10 @@ HttpMalformedHeaderException, HttpEncodingException.

    Instantiate a new HttpRequestPool object. An HttpRequestPool is
    able to send several HttpRequests in parallel.

    WARNING: Don't attach/detach HttpRequest objects to the HttpRequestPool
    -object while you're using the implemented Interator interface.

    +object while you're using the implemented Iterator interface.

    Accepts virtual infinite optional parameters each referencing an
    HttpRequest object.

    -

    Throws HttpRequestException, HttpRequestPoolException, HttpInvalidParamException.

    +

    Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).

    Example:


    <?php
    try {
        
    $pool = new HttpRequestPool(
            new 
    HttpRequest('http://www.google.com/'HttpRequest::METH_HEAD),
            new 
    HttpRequest('http://www.php.net/'HttpRequest::METH_HEAD)
        );
        
    $pool->send();
        foreach(
    $pool as $request) {
            
    printf("%s is %s (%d)\n",
                
    $request->getUrl(),
                
    $request->getResponseCode() ? 'alive' 'not alive',
                
    $request->getResponseCode()
            );
        }
    } catch (
    HttpException $e) {
        echo 
    $e;
    }
    ?>

    @@ -743,7 +970,7 @@ HttpRequest object.

    bool HttpRequestPool::attach(HttpRequest request)

    Attach an HttpRequest object to this HttpRequestPool.
    WARNING: set all options prior attaching!

    -

    Expects the parameter to be an HttpRequest object not alread attached to
    +

    Expects the parameter to be an HttpRequest object not already attached to
    antother HttpRequestPool object.

    Returns TRUE on success, or FALSE on failure.

    Throws HttpInvalidParamException, HttpRequestException,
    @@ -757,8 +984,7 @@ HttpRequestPool object.

    bool HttpRequestPool::send()

    Send all attached HttpRequest objects in parallel.

    Returns TRUE on success, or FALSE on failure.

    -

    Throws HttpSocketException, HttpRequestException,
    -HttpRequestPoolException, HttpMalformedHeaderException.

    +

    Throws HttpRequestPoolException (HttpSocketException, HttpRequestException, HttpMalformedHeaderException).

    protected bool HttpRequestPool::socketPerform()

    Returns TRUE until each request has finished its transaction.

    Usage:


    @@ -778,6 +1004,9 @@ HttpRequestPoolException, HttpMalformedHeaderException.

    Implements Iterator::next().

    void HttpRequestPool::rewind()

    Implements Iterator::rewind().

    +

    int HttpRequestPool::count()

    +

    Implements Countable.

    +

    Returns the number of attached HttpRequest objects.

    array HttpRequestPool::getAttachedRequests()

    Get attached HttpRequest objects.

    Returns an array containing all currently attached HttpRequest objects.

    @@ -787,6 +1016,7 @@ HttpRequestPoolException, HttpMalformedHeaderException.

    already have finished their work.


    http_response_object.c

    +

    HttpResponse

    static bool HttpResponse::setHeader(string name, mixed value[, bool replace = true])

    Send an HTTP header.

    Expects a string parameter containing the name of the header and a mixed
    @@ -801,17 +1031,18 @@ parameter is unset no header with this name will be sent.

    Accepts a string as optional parameter which specifies the name of the
    header to read. If the parameter is empty or omitted, an associative array
    with all headers will be returned.

    +

    NOTE: In Apache2 this only works for PHP-5.1.3 and greater.

    Returns either a string containing the value of the header matching name,
    FALSE on failure, or an associative array with all headers.

    static bool HttpResponse::setCache(bool cache)

    -

    Whether it sould be attempted to cache the entitity.
    +

    Whether it should be attempted to cache the entity.
    This will result in necessary caching headers and checks of clients
    "If-Modified-Since" and "If-None-Match" headers. If one of those headers
    matches a "304 Not Modified" status code will be issued.

    -

    NOTE: If you're using sessions, be shure that you set session.cache_limiter
    +

    NOTE: If you're using sessions, be sure that you set session.cache_limiter
    to something more appropriate than "no-cache"!

    Expects a boolean as parameter specifying whether caching should be attempted.

    -

    Returns TRUE ons success, or FALSE on failure.

    +

    Returns TRUE on success, or FALSE on failure.

    static bool HttpResponse::getCache()

    Get current caching setting.

    Returns TRUE if caching should be attempted, else FALSE.

    @@ -822,11 +1053,13 @@ to something more appropriate than "no-cache"!

    static bool HttpResponse::getGzip()

    Get current gzipping setting.

    Returns TRUE if GZip compression is enabled, else FALSE.

    -

    static bool HttpResponse::setCacheControl(string control[, int max_age = 0])

    +

    static bool HttpResponse::setCacheControl(string control[, int max_age = 0[, bool must_revalidate = true]])

    Set a custom cache-control header, usually being "private" or "public";
    The max_age parameter controls how long the cache entry is valid on the client side.

    Expects a string parameter containing the primary cache control setting.
    -Addtitionally accepts an int parameter specifying the max-age setting.

    +Additionally accepts an int parameter specifying the max-age setting.
    +Accepts an optional third bool parameter indicating whether the cache
    +must be revalidated every request.

    Returns TRUE on success, or FALSE if control does not match one of
    "public" , "private" or "no-cache".

    Throws HttpInvalidParamException if http.only_exceptions is TRUE.

    @@ -855,7 +1088,7 @@ if http.only_exceptions is TRUE.

    Set the Content-Disposition. The Content-Disposition header is very useful
    if the data actually sent came from a file or something similar, that should
    be "saved" by the client/user (i.e. by browsers "Save as..." popup window).

    -

    Expects a string parameter specifying the file name the "Save as..." dialogue
    +

    Expects a string parameter specifying the file name the "Save as..." dialog
    should display. Optionally accepts a bool parameter, which, if set to true
    and the user agent knows how to handle the content type, will probably not
    cause the popup window to be shown.

    @@ -924,12 +1157,12 @@ which the data to send will be read.

    Returns the previously set path to the file to send as string.

    static bool HttpResponse::send([bool clean_ob = true])

    Finally send the entity.

    -

    Accepts an optional boolean parameter, specifying wheter the ouput
    +

    Accepts an optional boolean parameter, specifying whether the output
    buffers should be discarded prior sending. A successful caching attempt
    will cause a script termination, and write a log entry if the INI setting
    http.cache_log is set.

    Returns TRUE on success, or FALSE on failure.

    -

    Throws HttpHeaderException, HttpResponseException if http.onyl_excpetions is TRUE.

    +

    Throws HttpHeaderException, HttpResponseException if http.only_exceptions is TRUE.

    Example:


    <?php
    HttpResponse
    ::setCache(true);
    HttpResponse::setContentType('application/pdf');
    HttpResponse::setContentDisposition("$user.pdf"false);
    HttpResponse::setFile('sheet.pdf');
    HttpResponse::send();
    ?>

    @@ -943,16 +1176,20 @@ http.cache_log is set.


    Table of Contents
    -

    Generated at: Fri, 04 Nov 2005 12:29:06 +0100

    +

    Generated at: Fri, 07 Jul 2006 21:23:59 +0200