X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=docs%2Ffunctions.html;h=743a151fc7ad938c919560bdb374cfd19c912321;hp=cca7dc41edede005dd153b669d52b5582f6011ca;hb=b9e4613eef61c3573a7dee58f555b2389698a097;hpb=24b00d45e94aef314ccee09a090609bd8a540926 diff --git a/docs/functions.html b/docs/functions.html index cca7dc4..743a151 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -74,7 +74,7 @@ looking like: "Wed, 22 Dec 2004 11:34:47 GMT"

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]]])

+

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
@@ -84,7 +84,7 @@ 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 naivly; no replacements are done
+ - 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
@@ -198,19 +198,19 @@ 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 algorithm 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 algorithm 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
@@ -243,7 +243,7 @@ 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.

Returns TRUE on success, or FALSE on failure.

@@ -284,6 +284,8 @@ several consecutive HTTP messages.

<?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.

@@ -310,6 +312,7 @@ 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
@@ -324,10 +327,13 @@ array where the following keys will be recognized:

 - redirect:
  - cookies:          array, list of cookies as associative array
like array("cookie" => "value")
- encodecookies: bool, whether to urlencode the cookies (default: true)
- - resetcookies: bool, wheter to reset the cookies
- 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
@@ -335,6 +341,8 @@ array where the following keys will be recognized:

 - redirect:
  - 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
@@ -383,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.

@@ -455,6 +477,9 @@ all supported features.


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.

@@ -488,6 +513,9 @@ HTTP messages. Accepts an optional string parameter specifying the class to use

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.

@@ -551,9 +579,17 @@ HttpMessage::TYPE_REQUEST or supplied URL 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.

@@ -578,9 +614,10 @@ should also contain any parent messages.

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)

+

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.

@@ -597,7 +634,7 @@ should also contain any parent messages.


http_querystring_object.c

HttpQueryString

-

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

+

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()

@@ -610,8 +647,30 @@ Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.

string HttpQueryString::set(mixed params)

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

-

HttpQueryString HttpQueryString::getInstance([bool global = true])

+

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

@@ -669,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.

@@ -766,6 +835,22 @@ 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
@@ -817,7 +902,7 @@ references the last received response.

references the last received response. Use HttpMessage::getParentMessage()
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.

@@ -946,6 +1031,7 @@ 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)

@@ -1140,6 +1226,8 @@ http.cache_log is set.

  • http_parse_cookie
  • +
  • http_parse_params +
  • http_get_request_headers
  • http_get_request_body @@ -1160,6 +1248,12 @@ http.cache_log is set.

  • http_put_stream
  • +
  • http_put_data +
  • +
  • http_request +
  • +
  • http_request_body_encode +
  • http_request_method_register
  • http_request_method_unregister @@ -1191,6 +1285,7 @@ http.cache_log is set.

  • http_inflatestream_object.c
  • @@ -1261,6 +1366,8 @@ http.cache_log is set.

  • HttpRequest::setCookies()
  • HttpRequest::addCookies()
  • HttpRequest::getCookies()
  • +
  • HttpRequest::enableCookies()
  • +
  • HttpRequest::resetCookies()
  • HttpRequest::setUrl()
  • HttpRequest::getUrl()
  • HttpRequest::setMethod()
  • @@ -1281,6 +1388,9 @@ http.cache_log is set.

  • HttpRequest::getPostFiles()
  • HttpRequest::setPutFile()
  • HttpRequest::getPutFile()
  • +
  • HttpRequest::setPutData()
  • +
  • HttpRequest::addPutData()
  • +
  • HttpRequest::getPutData()
  • HttpRequest::getResponseData()
  • HttpRequest::getResponseHeader()
  • HttpRequest::getResponseCookies()
  • @@ -1355,7 +1465,7 @@ http.cache_log is set.

    -

    Generated at: Wed, 15 Feb 2006 08:40:01 +0100

    +

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