From: Michael Wallner
Returns the HTTP date as string.
Returns the new URL as string on success or FALSE on failure.
+Opponent to parse_str().
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)
@@ -94,7 +96,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)
@@ -107,7 +109,7 @@ if none match.
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 cotaining the supported content types as values.
+
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
@@ -136,7 +138,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.
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.
Attempts to cache the sent entity by its last modification date.
@@ -172,7 +174,7 @@ the Last-Modified header is updated and the actual body will be sent. http.cache_log is set and the cache attempt was successful.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".
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.
For use with ob_start(). Output buffer handler generating an ETag with
-the hash algorythm specified with the INI setting "http.etag_mode".
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
@@ -210,21 +212,21 @@ You can use one of the following constants for convenience:
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 URL." will be displayed,
-if the client doesn't redirect immediatly, and the request method was
+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.
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.
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.
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.
Decodes a string that was HTTP-chunked encoded.
@@ -234,7 +236,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:
@@ -286,7 +288,6 @@ array where the following keys will be recognized:
<?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] => ...
)
)
?>
- redirect: - 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
@@ -301,12 +302,29 @@ array where the following keys will be recognized:- redirect: - 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
+ - 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:
+in form of an associative array, if supplied, like the following example:@@ -316,19 +334,19 @@ 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,
)
?>
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]])
@@ -353,28 +371,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_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.Returns the encoded string on success, or NULL on failure.
string http_inflate(string data)
-Uncompress data compressed with either gzip, deflate AKA zlib or raw
+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_gzhanlder and zlib.output_compression as well and should
+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:
@@ -432,8 +448,8 @@ prior messages, those can be accessed by HttpMessage::getParentMessage().Throws HttpMalformedHeaderException.
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. Accepts an optionsl string parameter specifying the class to use.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()
@@ -462,7 +478,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
@@ -472,6 +488,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
@@ -561,15 +586,15 @@ Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.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.
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.
@@ -588,7 +613,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])
@@ -683,11 +708,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
@@ -712,7 +737,7 @@ If the parameter is empty or omitted the put file will be unset.
primary and a secondary content type part.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
@@ -721,7 +746,7 @@ references the last received response.
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 response headers.
-FALSE on failure, or an associative array containing all reponse headers.If redirects were allowed and several responses were received, the data
references the last received response.array HttpRequest::getResponseCookie([string name])
@@ -744,6 +769,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.
@@ -760,7 +788,7 @@ references the last received response.
See http_get() for a full list of returned info.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.
HttpMessage HttpRequest::getRequestMessage()
@@ -768,7 +796,7 @@ cycle.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
@@ -784,7 +812,7 @@ may have made to the returned object.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::$recordHistory to FALSE.
-HttpRequest::$recoedHistory to FALSE.Returns an HttpMessage object representing the complete request/response
history.The object references the last received response, use HttpMessage::getParentMessage()
@@ -833,7 +861,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,
@@ -897,14 +925,14 @@ with all headers will be returned.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.
@@ -919,7 +947,7 @@ to something more appropriate than "no-cache"!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.
+Additionally accepts an int parameter specifying the max-age setting.
-Addtitionally accepts an int parameter specifying the max-age setting.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.
@@ -948,7 +976,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
@@ -1017,12 +1045,12 @@ which the data to send will be read.
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.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:
@@ -1042,6 +1070,8 @@ http.cache_log is set.
<?php
HttpResponse::setCache(true);
HttpResponse::setContentType('application/pdf');
HttpResponse::setContentDisposition("$user.pdf", false);
HttpResponse::setFile('sheet.pdf');
HttpResponse::send();
?>
http_build_url +http_build_str + http_negotiate_language http_negotiate_charset @@ -1112,8 +1142,6 @@ http.cache_log is set. http_request_method_name -http_build_query - http_deflate http_inflate @@ -1156,6 +1184,8 @@ http.cache_log is set. HttpMessage::setType() HttpMessage::getResponseCode() HttpMessage::setResponseCode() +HttpMessage::getResponseStatus() +HttpMessage::setResponseStatus() HttpMessage::getRequestMethod() HttpMessage::setRequestMethod() HttpMessage::getRequestUrl() @@ -1229,6 +1259,7 @@ http.cache_log is set.HttpRequest::getResponseCookie() HttpRequest::getResponseBody() HttpRequest::getResponseCode() +HttpRequest::getResponseStatus() HttpRequest::getResponseInfo() HttpRequest::getResponseMessage() HttpRequest::getRequestMessage() @@ -1297,7 +1328,7 @@ http.cache_log is set. -Generated at: Fri, 03 Feb 2006 10:38:18 +0100
+Generated at: Mon, 06 Feb 2006 13:45:38 +0100