release 1.7.6
[m6w6/ext-http] / docs / functions.html
index 2f7668eba3f34fa59899367cc1ff42e8f450232d..743a151fc7ad938c919560bdb374cfd19c912321 100644 (file)
@@ -74,7 +74,7 @@
 looking like: "Wed, 22 Dec 2004 11:34:47 GMT"</p>
 <p>Accepts an optional unix timestamp as parameter.</p>
 <p>Returns the HTTP date as string.</p>
-<h2 id="http_build_url">string http_build_url(mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]])</h2>
+<h2 id="http_build_url">string http_build_url([mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]]])</h2>
 <p>Build an URL.</p>
 <p>Expexts (part(s) of) an URL as first parameter in form of a string or assoziative array<br />
 like parse_url() returns.  Accepts an optional second parameter in the same way as the<br />
@@ -84,7 +84,7 @@ with the results as associative array like parse_url() would return.</p>
 <p>The parts of the second URL will be merged into the first according to the flags argument.<br />
 The following flags are recognized:</p><pre>   - HTTP_URL_REPLACE:        (default) set parts of the second url will replace the parts in the first<br />
        - HTTP_URL_JOIN_PATH:      the path of the second url will be merged into the one of the first<br />
-       - HTTP_URL_JOIN_QUERY:     the two querystrings will be merged naivly; no replacements are done<br />
+       - HTTP_URL_JOIN_QUERY:     the two querystrings will be merged recursively<br />
        - HTTP_URL_STRIP_USER:     the user part will not appear in the result<br />
        - HTTP_URL_STRIP_PASS:     the password part will not appear in the result<br />
        - HTTP_URL_STRIP_AUTH:     neither the user nor the password part will appear in the result<br />
@@ -198,19 +198,19 @@ requested last modification date is not between the calculated timespan,<br />
 the Last-Modified header is updated and the actual body will be sent.</p>
 <p>Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.</p>
 <p>A log entry will be written to the cache log if the INI entry<br />
-http.cache_log is set and the cache attempt was successful.</p>
+http.log.cache is set and the cache attempt was successful.</p>
 <h2 id="http_cache_etag">bool http_cache_etag([string etag])</h2>
 <p>Attempts to cache the sent entity by its ETag, either supplied or generated <br />
-by the hash algorithm specified by the INI setting "http.etag_mode".</p>
+by the hash algorithm specified by the INI setting "http.etag.mode".</p>
 <p>If the clients "If-None-Match" header matches the supplied/calculated<br />
 ETag, the body is considered cached on the clients side and<br />
 a "304 Not Modified" status code is issued.</p>
 <p>Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.</p>
 <p>A log entry is written to the cache log if the INI entry<br />
-"http.cache_log" is set and the cache attempt was successful.</p>
+"http.log.cache" is set and the cache attempt was successful.</p>
 <h2 id="ob_etaghandler">string ob_etaghandler(string data, int mode)</h2>
 <p>For use with ob_start().  Output buffer handler generating an ETag with<br />
-the hash algorithm specified with the INI setting "http.etag_mode".</p>
+the hash algorithm specified with the INI setting "http.etag.mode".</p>
 <h2 id="http_throttle">void http_throttle(double sec[, int bytes = 40960])</h2>
 <p>Sets the throttle delay and send buffer size for use with http_send() API.<br />
 Provides a basic throttling mechanism, which will yield the current process<br />
@@ -243,7 +243,7 @@ if the client doesn't redirect immediately, and the request method was<br />
 another one than HEAD.</p>
 <p>Returns FALSE on failure, or *exits* on success.</p>
 <p>A log entry will be written to the redirect log, if the INI entry<br />
-"http.redirect_log" is set and the redirect attempt was successful.</p>
+"http.log.redirect" is set and the redirect attempt was successful.</p>
 <h2 id="http_send_data">bool http_send_data(string data)</h2>
 <p>Sends raw data with support for (multiple) range requests.</p>
 <p>Returns TRUE on success, or FALSE on failure.</p>
@@ -284,6 +284,8 @@ several consecutive HTTP messages.</p>
 <span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">http_parse_cookie</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo=bar;&nbsp;bar=baz;&nbsp;path=/;&nbsp;domain=example.com;&nbsp;comment=;&nbsp;secure"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">"comment"</span><span style="color: #007700">)));<br /><br /></span><span style="color: #0000BB">stdClass&nbsp;Object<br /></span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">cookies</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;Array<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">foo</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">bar<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">bar</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">baz<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">extras</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;Array<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">comment</span><span style="color: #007700">]&nbsp;=&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">flags</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">16<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">expires</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">0<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">path</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;/<br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">domain</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">example</span><span style="color: #007700">.</span><span style="color: #0000BB">com<br /></span><span style="color: #007700">)<br /></span><span style="color: #0000BB">?&gt;</span><br />
 </span></code></blockquote></p>
 <p></pre></p>
+<h2 id="http_parse_params">object http_parse_params(string param[, int flags = HTTP_PARAMS_DEFAULT])</h2>
+<p>Parse parameter list.</p>
 <h2 id="http_get_request_headers">array http_get_request_headers(void)</h2>
 <p>Get a list of incoming HTTP headers.</p>
 <p>Returns an associative array of incoming request headers.</p>
@@ -325,9 +327,8 @@ array where the following keys will be recognized:</p><pre> - redirect:
  - cookies:          array, list of cookies as associative array<br />
                      like array("cookie" => "value")<br />
  - encodecookies:    bool, whether to urlencode the cookies (default: true)<br />
- - resetcookies:     bool, wheter to reset the cookies<br />
  - cookiestore:      string, path to a file where cookies are/will be stored<br />
- - cookiesession:    bool, accept (true) or reset (false) sessioncookies<br />
+ - cookiesession:    bool, don't load session cookies from cookiestore if TRUE<br />
  - resume:           int, byte offset to start the download from;<br />
                      if the server supports ranges<br />
  - range:            array, array of arrays, each containing two integers,<br />
@@ -396,6 +397,15 @@ See http_get() for a full list of available options.</p>
 <p>Expects the second parameter to be a string containing the data to upload.<br />
 See http_get() for a full list of available options.</p>
 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
+<h2 id="http_request">string http_request(int method, string url[, string body[, array options[, array &info]]])</h2>
+<p>Performs a custom HTTP request on the supplied url.</p>
+<p>Expects the first parameter to be an integer specifying the request method to use.<br />
+Accepts an optional third string parameter containing the raw request body.<br />
+See http_get() for a full list of available options.</p>
+<p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
+<h2 id="http_request_body_encode">string http_request_body_encode(array fields, array files)</h2>
+<p>Generate x-www-form-urlencoded resp. form-data encoded request body.</p>
+<p>Returns encoded string on success, or FALSE on failure.</p>
 <h2 id="http_request_method_register">int http_request_method_register(string method)</h2>
 <p>Register a custom request method.</p>
 <p>Expects a string parameter containing the request method name to register.</p>
@@ -467,6 +477,9 @@ all supported features.</p>
 <hr noshade>
 <h1 id="http_inflatestream_object.c">http_inflatestream_object.c</h1>
 <h2 id="HttpInflateStream" class="o">HttpInflateStream</h2>
+<h3 id="HttpInflateStream___construct">void HttpInflateStream::__construct([int flags = 0])</h3>
+<p>Creates a new HttpInflateStream object instance.</p>
+<p>Accepts an optional int parameter specifying how to initialize the inflate stream.</p>
 <h3 id="HttpInflateStream_update">string HttpInflateStream::update(string data)</h3>
 <p>Passes more data through the inflate stream.</p>
 <p>Expects a string parameter containing (a part of) the data to inflate.</p>
@@ -500,6 +513,9 @@ HTTP messages.  Accepts an optional string parameter specifying the class to use
 <p>Set the body of the HttpMessage.<br />
 NOTE: Don't forget to update any headers accordingly.</p>
 <p>Expects a string parameter containing the new body of the message.</p>
+<h3 id="HttpMessage_getHeader">string HttpMessage::getHeader(string header)</h3>
+<p>Get message header.</p>
+<p>Returns the header value on success or NULL if the header does not exist.</p>
 <h3 id="HttpMessage_getHeaders">array HttpMessage::getHeaders()</h3>
 <p>Get Message Headers.</p>
 <p>Returns an associative array containing the messages HTTP headers.</p>
@@ -563,10 +579,17 @@ HttpMessage::TYPE_REQUEST or supplied URL was empty.</p>
 <p>Set the HTTP Protocol version of the Message.</p>
 <p>Expects a string parameter containing the HTTP protocol version.</p>
 <p>Returns TRUE on success, or FALSE if supplied version is out of range (1.0/1.1).</p>
+<h3 id="HttpMessage_guessContentType">string HttpMessage::guessContentType(string magic_file[, int magic_mode = MAGIC_MIME])</h3>
+<p>Attempts to guess the content type of supplied payload through libmagic.</p>
+<p>Expects a string parameter specifying the magic.mime database to use.<br />
+Additionally accepts an optional int parameter, being flags for libmagic.</p>
+<p>Returns the guessed content type on success, or FALSE on failure.</p>
+<p>Throws HttpRuntimeException, HttpInvalidParamException <br />
+if http.only_exceptions is TRUE.</p>
 <h3 id="HttpMessage_getParentMessage">HttpMessage HttpMessage::getParentMessage()</h3>
 <p>Get parent Message.</p>
 <p>Returns the parent HttpMessage on success, or NULL if there's none.</p>
-<p>Throws HttpMessageException.</p>
+<p>Throws HttpRuntimeException.</p>
 <h3 id="HttpMessage_send">bool HttpMessage::send()</h3>
 <p>Send the Message according to its type as Response or Request.<br />
 This provides limited functionality compared to HttpRequest and HttpResponse.</p>
@@ -591,9 +614,10 @@ should also contain any parent messages.</p>
 <p>Re-constructs the HttpMessage based upon the serialized string.</p>
 <h3 id="HttpMessage_detach">HttpMessage HttpMessage::detach(void)</h3>
 <p>Returns a clone of an HttpMessage object detached from any parent messages.</p>
-<h3 id="HttpMessage_prepend">void HttpMessage::prepend(HttpMessage message)</h3>
+<h3 id="HttpMessage_prepend">void HttpMessage::prepend(HttpMessage message[, bool top = true])</h3>
 <p>Prepends message(s) to the HTTP message.</p>
 <p>Expects an HttpMessage object as parameter.</p>
+<p>Throws HttpInvalidParamException if the message is located within the same message chain.</p>
 <h3 id="HttpMessage_reverse">HttpMessage HttpMessage::reverse()</h3>
 <p>Reorders the message chain in reverse order.</p>
 <p>Returns the most parent HttpMessage object.</p>
@@ -623,7 +647,13 @@ Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.</
 "b" for bool, "i" for int, "f" for float, "s" for string, "a" for array and "o" for a stdClass object.</p>
 <h3 id="HttpQueryString_set">string HttpQueryString::set(mixed params)</h3>
 <p>Set query string entry/entries. NULL values will unset the variable.</p>
-<h3 id="HttpQueryString_singleton">HttpQueryString HttpQueryString::singleton([bool global = true])</h3>
+<h3 id="HttpQueryString_mod">HttpQueryString HttpQueryString::mod(mixed params)</h3>
+<p>Copies the query string object and sets provided params at the clone.<br />
+This is basically shorthand for:</p><pre><blockquote><code><span style="color: #000000"><br />
+<span style="color: #0000BB">&lt;?php<br />$newQS&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpQueryString</span><span style="color: #007700">(</span><span style="color: #0000BB">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$oldQS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$newQS</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #0000BB">$other_params</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span><br />
+</span></code></blockquote></p>
+<p></pre></p>
+<h3 id="HttpQueryString_singleton">static HttpQueryString HttpQueryString::singleton([bool global = true])</h3>
 <p>Get a single instance (differentiates between the global setting).</p>
 <h3 id="HttpQueryString_xlate">bool HttpQueryString::xlate(string ie, string oe)</h3>
 <p>Converts the query string from the source encoding ie to the target encoding oe.<br />
@@ -633,6 +663,14 @@ WARNING: Don't use any character set that can contain NUL bytes like UTF-16.</p>
 <p>Implements Serializable.</p>
 <h3 id="HttpQueryString_unserialize">void HttpQueryString::unserialize(string serialized)</h3>
 <p>Implements Serializable.</p>
+<h3 id="HttpQueryString_offsetGet">mixed HttpQueryString::offsetGet(string offset)</h3>
+<p>Implements ArrayAccess.</p>
+<h3 id="HttpQueryString_offsetSet">void HttpQueryString::offsetSet(string offset, mixed value)</h3>
+<p>Implements ArrayAccess.</p>
+<h3 id="HttpQueryString_offsetExists">bool HttpQueryString::offsetExists(string offset)</h3>
+<p>Implements ArrayAccess.</p>
+<h3 id="HttpQueryString_offsetUnset">void HttpQueryString::offsetUnset(string offset)</h3>
+<p>Implements ArrayAccess.</p>
 <hr noshade>
 <h1 id="http_request_object.c">http_request_object.c</h1>
 <h2 id="HttpRequest" class="o">HttpRequest</h2>
@@ -690,6 +728,16 @@ pairs to add.</p>
 <h3 id="HttpRequest_getCookies">array HttpRequest::getCookies()</h3>
 <p>Get previously set cookies.</p>
 <p>Returns an associative array containing any previously set cookies.</p>
+<h3 id="HttpRequest_enableCookies">bool HttpRequest::enableCookies()</h3>
+<p>Enable automatic sending of received cookies.<br />
+Note that cuutomly set cookies will be sent anyway.</p>
+<h3 id="HttpRequest_resetCookies">bool HttpRequest::resetCookies([bool session_only = FALSE])</h3>
+<p>Reset all automatically received/sent cookies.<br />
+Note that customly set cookies are not affected.</p>
+<p>Accepts an optional bool parameter specifying<br />
+whether only session cookies should be reset<br />
+(needs libcurl >= v7.15.4, else libcurl >= v7.14.1).</p>
+<p>Returns TRUE on success, or FALSE on failure.</p>
 <h3 id="HttpRequest_setUrl">bool HttpRequest::setUrl(string url)</h3>
 <p>Set the request URL.</p>
 <p>Expects a string as parameter specifying the request url.</p>
@@ -983,6 +1031,7 @@ parameter is unset no header with this name will be sent. </p>
 <p>Accepts a string as optional parameter which specifies the name of the<br />
 header to read.  If the parameter is empty or omitted, an associative array<br />
 with all headers will be returned.</p>
+<p>NOTE: In Apache2 this only works for PHP-5.1.3 and greater.</p>
 <p>Returns either a string containing the value of the header matching name,<br />
 FALSE on failure, or an associative array with all headers.</p>
 <h3 id="HttpResponse_setCache">static bool HttpResponse::setCache(bool cache)</h3>
@@ -1177,6 +1226,8 @@ http.cache_log is set.</p>
 </li>
 <li><a href="#http_parse_cookie">http_parse_cookie</a>
 </li>
+<li><a href="#http_parse_params">http_parse_params</a>
+</li>
 <li><a href="#http_get_request_headers">http_get_request_headers</a>
 </li>
 <li><a href="#http_get_request_body">http_get_request_body</a>
@@ -1199,6 +1250,10 @@ http.cache_log is set.</p>
 </li>
 <li><a href="#http_put_data">http_put_data</a>
 </li>
+<li><a href="#http_request">http_request</a>
+</li>
+<li><a href="#http_request_body_encode">http_request_body_encode</a>
+</li>
 <li><a href="#http_request_method_register">http_request_method_register</a>
 </li>
 <li><a href="#http_request_method_unregister">http_request_method_unregister</a>
@@ -1230,6 +1285,7 @@ http.cache_log is set.</p>
 </li>
 <li><a class="tocfile" href="#http_inflatestream_object.c">http_inflatestream_object.c</a>
 <ul>
+<li><a href="#HttpInflateStream___construct">HttpInflateStream::__construct()</a></li>
 <li><a href="#HttpInflateStream_update">HttpInflateStream::update()</a></li>
 <li><a href="#HttpInflateStream_flush">HttpInflateStream::flush()</a></li>
 <li><a href="#HttpInflateStream_finish">HttpInflateStream::finish()</a></li>
@@ -1242,6 +1298,7 @@ http.cache_log is set.</p>
 <li><a href="#HttpMessage_fromString">HttpMessage::fromString()</a></li>
 <li><a href="#HttpMessage_getBody">HttpMessage::getBody()</a></li>
 <li><a href="#HttpMessage_setBody">HttpMessage::setBody()</a></li>
+<li><a href="#HttpMessage_getHeader">HttpMessage::getHeader()</a></li>
 <li><a href="#HttpMessage_getHeaders">HttpMessage::getHeaders()</a></li>
 <li><a href="#HttpMessage_setHeaders">HttpMessage::setHeaders()</a></li>
 <li><a href="#HttpMessage_addHeaders">HttpMessage::addHeaders()</a></li>
@@ -1257,6 +1314,7 @@ http.cache_log is set.</p>
 <li><a href="#HttpMessage_setRequestUrl">HttpMessage::setRequestUrl()</a></li>
 <li><a href="#HttpMessage_getHttpVersion">HttpMessage::getHttpVersion()</a></li>
 <li><a href="#HttpMessage_setHttpVersion">HttpMessage::setHttpVersion()</a></li>
+<li><a href="#HttpMessage_guessContentType">HttpMessage::guessContentType()</a></li>
 <li><a href="#HttpMessage_getParentMessage">HttpMessage::getParentMessage()</a></li>
 <li><a href="#HttpMessage_send">HttpMessage::send()</a></li>
 <li><a href="#HttpMessage_toString">HttpMessage::toString()</a></li>
@@ -1282,10 +1340,15 @@ http.cache_log is set.</p>
 <li><a href="#HttpQueryString_toArray">HttpQueryString::toArray()</a></li>
 <li><a href="#HttpQueryString_get">HttpQueryString::get()</a></li>
 <li><a href="#HttpQueryString_set">HttpQueryString::set()</a></li>
+<li><a href="#HttpQueryString_mod">HttpQueryString::mod()</a></li>
 <li><a href="#HttpQueryString_singleton">HttpQueryString::singleton()</a></li>
 <li><a href="#HttpQueryString_xlate">HttpQueryString::xlate()</a></li>
 <li><a href="#HttpQueryString_serialize">HttpQueryString::serialize()</a></li>
 <li><a href="#HttpQueryString_unserialize">HttpQueryString::unserialize()</a></li>
+<li><a href="#HttpQueryString_offsetGet">HttpQueryString::offsetGet()</a></li>
+<li><a href="#HttpQueryString_offsetSet">HttpQueryString::offsetSet()</a></li>
+<li><a href="#HttpQueryString_offsetExists">HttpQueryString::offsetExists()</a></li>
+<li><a href="#HttpQueryString_offsetUnset">HttpQueryString::offsetUnset()</a></li>
 </li>
 </ul>
 </li>
@@ -1303,6 +1366,8 @@ http.cache_log is set.</p>
 <li><a href="#HttpRequest_setCookies">HttpRequest::setCookies()</a></li>
 <li><a href="#HttpRequest_addCookies">HttpRequest::addCookies()</a></li>
 <li><a href="#HttpRequest_getCookies">HttpRequest::getCookies()</a></li>
+<li><a href="#HttpRequest_enableCookies">HttpRequest::enableCookies()</a></li>
+<li><a href="#HttpRequest_resetCookies">HttpRequest::resetCookies()</a></li>
 <li><a href="#HttpRequest_setUrl">HttpRequest::setUrl()</a></li>
 <li><a href="#HttpRequest_getUrl">HttpRequest::getUrl()</a></li>
 <li><a href="#HttpRequest_setMethod">HttpRequest::setMethod()</a></li>
@@ -1400,7 +1465,7 @@ http.cache_log is set.</p>
 </li>
 </ul>
 </div>
-    <p><b>Generated at: Tue, 07 Mar 2006 15:57:21 +0100</b></p>
+    <p><b>Generated at: Fri, 07 Jul 2006 21:23:59 +0200</b></p>
 </body>
 </html>