<p>Expects a string parameter containing HTTP headers.</p>
<p>Returns an array on success, or FALSE on failure.</p>
<p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
-<span style="color: #0000BB"><?php<br />$headers </span><span style="color: #007700">= </span><span style="color: #DD0000">"content-type: text/html; charset=UTF-8\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Server: Funky/1.0\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Set-Cookie: foo=bar\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Set-Cookie: baz=quux\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Folded: works\r\n\ttoo\r\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">http_parse_headers</span><span style="color: #007700">(</span><span style="color: #0000BB">$headers</span><span style="color: #007700">));<br /><br />Array<br />(<br /> [</span><span style="color: #0000BB">Content</span><span style="color: #007700">-</span><span style="color: #0000BB">Type</span><span style="color: #007700">] => </span><span style="color: #0000BB">text</span><span style="color: #007700">/</span><span style="color: #0000BB">html</span><span style="color: #007700">; </span><span style="color: #0000BB">chatset</span><span style="color: #007700">=</span><span style="color: #0000BB">UTF</span><span style="color: #007700">-</span><span style="color: #0000BB">8<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">Server</span><span style="color: #007700">] => </span><span style="color: #0000BB">Funky</span><span style="color: #007700">/</span><span style="color: #0000BB">1.0<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">Set</span><span style="color: #007700">-</span><span style="color: #0000BB">Cookie</span><span style="color: #007700">] => Array<br /> (<br /> [</span><span style="color: #0000BB">0</span><span style="color: #007700">] => </span><span style="color: #0000BB">foo</span><span style="color: #007700">=</span><span style="color: #0000BB">bar<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] => </span><span style="color: #0000BB">baz</span><span style="color: #007700">=</span><span style="color: #0000BB">quux<br /> </span><span style="color: #007700">)<br /> [</span><span style="color: #0000BB">Folded</span><span style="color: #007700">] => </span><span style="color: #0000BB">works<br /> too <br />?></span><br />
+<span style="color: #0000BB"><?php<br />$headers </span><span style="color: #007700">= </span><span style="color: #DD0000">"content-type: text/html; charset=UTF-8\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Server: Funky/1.0\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Set-Cookie: foo=bar\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Set-Cookie: baz=quux\r\n"</span><span style="color: #007700">.<br /> </span><span style="color: #DD0000">"Folded: works\r\n\ttoo\r\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">http_parse_headers</span><span style="color: #007700">(</span><span style="color: #0000BB">$headers</span><span style="color: #007700">));<br /><br />Array<br />(<br /> [</span><span style="color: #0000BB">Content</span><span style="color: #007700">-</span><span style="color: #0000BB">Type</span><span style="color: #007700">] => </span><span style="color: #0000BB">text</span><span style="color: #007700">/</span><span style="color: #0000BB">html</span><span style="color: #007700">; </span><span style="color: #0000BB">chatset</span><span style="color: #007700">=</span><span style="color: #0000BB">UTF</span><span style="color: #007700">-</span><span style="color: #0000BB">8<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">Server</span><span style="color: #007700">] => </span><span style="color: #0000BB">Funky</span><span style="color: #007700">/</span><span style="color: #0000BB">1.0<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">Set</span><span style="color: #007700">-</span><span style="color: #0000BB">Cookie</span><span style="color: #007700">] => Array<br /> (<br /> [</span><span style="color: #0000BB">0</span><span style="color: #007700">] => </span><span style="color: #0000BB">foo</span><span style="color: #007700">=</span><span style="color: #0000BB">bar<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] => </span><span style="color: #0000BB">baz</span><span style="color: #007700">=</span><span style="color: #0000BB">quux<br /> </span><span style="color: #007700">)<br /> [</span><span style="color: #0000BB">Folded</span><span style="color: #007700">] => </span><span style="color: #0000BB">works<br /> too <br /></span><span style="color: #007700">) <br /></span><span style="color: #0000BB">?></span><br />
+</span></code></blockquote></p>
+<p></pre></p>
+<h2 id="http_parse_cookie">object http_parse_cookie(string cookie)</h2>
+<p>Parses HTTP cookies like sent in a response into a struct.</p>
+<p>Expects a string as parameter containing the value of a Set-Cookie response header.</p>
+<p>Returns an stdClass object with the cookie params as properties on success or FALSE on failure.</p>
+<p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
+<span style="color: #0000BB"><?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; path=/"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">stdClass Object<br /></span><span style="color: #007700">(<br /> [</span><span style="color: #0000BB">name</span><span style="color: #007700">] => </span><span style="color: #0000BB">foo<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">value</span><span style="color: #007700">] => </span><span style="color: #0000BB">bar<br /> </span><span style="color: #007700">[</span><span style="color: #0000BB">path</span><span style="color: #007700">] => /<br />)<br /></span><span style="color: #0000BB">?></span><br />
</span></code></blockquote></p>
<p></pre></p>
<h2 id="http_get_request_headers">array http_get_request_headers(void)</h2>
<p>Returns the request method name as string on success, or FALSE on failure.</p>
<h2 id="http_build_query">string http_build_query(mixed formdata [, string prefix[, string arg_separator]])</h2>
<p>Generates a form-encoded query string from an associative array or object.</p>
-<h2 id="http_gzencode">string http_gzencode(string data[, int level = -1])</h2>
+<h2 id="http_gzencode">string http_gzencode(string data[, int level = -1[, int mtime = 0]])</h2>
<p>Compress data with the HTTP compatible GZIP encoding.</p>
<p>Expects the first parameter to be a string which contains the data that<br />
should be encoded. Additionally accepts an optional in paramter specifying<br />
<p>Uncompress data compressed with the HTTP compatible GZIP encoding.</p>
<p>Expects a string as parameter containing the compressed data.</p>
<p>Returns the decoded string on success, or NULL on failure.</p>
-<h2 id="http_deflate">string http_deflate(string data[, int level = -1])</h2>
+<h2 id="http_deflate">string http_deflate(string data[, int level = -1[, bool zlib_header = false]])</h2>
<p>Compress data with the HTTP compatible DEFLATE encoding.</p>
<p>Expects the first parameter to be a string containing the data that should<br />
be encoded. Additionally accepts an optional int parameter specifying the<br />
<p>Uncompress data compressed with the HTTP compatible DEFLATE encoding.</p>
<p>Expects a string as parameter containing the compressed data.</p>
<p>Returns the decoded string on success, or NULL on failure.</p>
-<h2 id="http_compress">string http_compress(string data[, int level = -1])</h2>
-<p>Compress data with the HTTP compatible COMPRESS encoding.</p>
-<p>Expects the first parameter to be a string containing the data which should<br />
-be encoded. Additionally accepts an optional int parameter specifying the<br />
-compression level, where -1 is default, 0 is no compression and 9 is best<br />
-compression ratio.</p>
-<p>Returns the encoded string on success, or NULL on failure.</p>
-<h2 id="http_uncompress">string http_uncompress(string data)</h2>
-<p>Uncompress data compressed with the HTTP compatible COMPRESS encoding.</p>
-<p>Expects a string as parameter containing the compressed data.</p>
-<p>Returns the decoded string on success, or NULL on failure.</p>
<h2 id="http_support">int http_support([int feature = 0])</h2>
<p>Check for feature that require external libraries.</p>
<p>Accpepts an optional in parameter specifying which feature to probe for.<br />
<p>Instantiate a new HttpRequestPool object. An HttpRequestPool is<br />
able to send several HttpRequests in parallel.</p>
<p>WARNING: Don't attach/detach HttpRequest objects to the HttpRequestPool<br />
-object while you're using the implemented Interator interface. </p>
+object while you're using the implemented Iterator interface. </p>
<p>Accepts virtual infinite optional parameters each referencing an<br />
HttpRequest object.</p>
<p>Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).</p>
</li>
<li><a href="#http_parse_headers">http_parse_headers</a>
</li>
+<li><a href="#http_parse_cookie">http_parse_cookie</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>
</li>
<li><a href="#http_inflate">http_inflate</a>
</li>
-<li><a href="#http_compress">http_compress</a>
-</li>
-<li><a href="#http_uncompress">http_uncompress</a>
-</li>
<li><a href="#http_support">http_support</a>
</li>
</ul>
</li>
</ul>
</div>
- <p><b>Generated at: Fri, 09 Dec 2005 13:56:42 +0100</b></p>
+ <p><b>Generated at: Wed, 14 Dec 2005 16:25:48 +0100</b></p>
</body>
</html>
PHP_FE(http_chunked_decode, NULL)
PHP_FE(http_parse_message, NULL)
PHP_FE(http_parse_headers, NULL)
+ PHP_FE(http_parse_cookie, NULL)
PHP_FE(http_get_request_headers, NULL)
PHP_FE(http_get_request_body, NULL)
PHP_FE(http_match_request_header, NULL)
* )
* [Folded] => works
* too
+ * )
* ?>
* </pre>
*/
}
/* }}}*/
+/* {{{ proto object http_parse_cookie(string cookie)
+ *
+ * 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 object with the cookie params as properties on success or FALSE on failure.
+ *
+ * Example:
+ * <pre>
+ * <?php
+ * print_r(http_parse_cookie("foo=bar; path=/"));
+ *
+ * stdClass Object
+ * (
+ * [name] => foo
+ * [value] => bar
+ * [path] => /
+ * )
+ * ?>
+ * </pre>
+ */
+PHP_FUNCTION(http_parse_cookie)
+{
+ char *cookie;
+ int cookie_len;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &cookie, &cookie_len)) {
+ RETURN_FALSE;
+ }
+
+ object_init(return_value);
+ if (SUCCESS != http_parse_cookie(cookie, HASH_OF(return_value))) {
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+}
+
/* {{{ proto array http_get_request_headers(void)
*
* Get a list of incoming HTTP headers.
HTTP_CURL_OPT(READFUNCTION, http_curl_read_callback);
HTTP_CURL_OPT(IOCTLFUNCTION, http_curl_ioctl_callback);
HTTP_CURL_OPT(WRITEFUNCTION, http_curl_dummy_callback);
- HTTP_CURL_OPT(PROGRESSFUNCTION, http_curl_progress_callback);
+ HTTP_CURL_OPT(PROGRESSFUNCTION, NULL);
HTTP_CURL_OPT(URL, NULL);
HTTP_CURL_OPT(NOPROGRESS, 1);
HTTP_CURL_OPT(PROXY, NULL);
HTTP_CURL_OPT(IOCTLDATA, NULL);
HTTP_CURL_OPT(READDATA, NULL);
HTTP_CURL_OPT(INFILESIZE, 0);
+#if 0
+ HTTP_CURL_OPT(IGNORE_CONTENT_ENCODING, 1);
+#endif
}
}
/* }}} */
if ((zoption = http_request_option(request, options, "onprogress", 0))) {
HTTP_CURL_OPT(NOPROGRESS, 0);
HTTP_CURL_OPT(PROGRESSDATA, request);
+ HTTP_CURL_OPT(PROGRESSFUNCTION, http_curl_progress_callback);
http_request_set_progress_callback(request, zoption);
}
HTTP_ARG_VAL(headers_string, 0)
HTTP_END_ARGS;
+HTTP_BEGIN_ARGS(parseCookie, 1)
+ HTTP_ARG_VAL(cookie_string, 0)
+HTTP_END_ARGS;
+
HTTP_BEGIN_ARGS(chunkedDecode, 1)
HTTP_ARG_VAL(encoded_string, 0)
HTTP_END_ARGS;
HTTP_UTIL_ALIAS(matchRequestHeader, http_match_request_header)
HTTP_UTIL_ALIAS(parseMessage, http_parse_message)
HTTP_UTIL_ALIAS(parseHeaders, http_parse_headers)
+ HTTP_UTIL_ALIAS(parseCookie, http_parse_cookie)
HTTP_UTIL_ALIAS(chunkedDecode, http_chunked_decode)
#ifdef HTTP_HAVE_ZLIB
HTTP_UTIL_ALIAS(gzEncode, http_gzencode)
+ Added 'bodyonly' request option
+ Added IOCTL callback for cURL
+ Added ssl_engines array and cookies array to the request info array
++ Added http_parse_cookie() to parse Set-Cookie headers
- Renamed http_connectcode to connect_code in the request info array
- Enable "original headers" previously stripped off by the message parser:
PHP_FUNCTION(http_chunked_decode);
PHP_FUNCTION(http_parse_message);
PHP_FUNCTION(http_parse_headers);
+PHP_FUNCTION(http_parse_cookie);
PHP_FUNCTION(http_get_request_headers);
PHP_FUNCTION(http_get_request_body);
PHP_FUNCTION(http_match_request_header);
PHP_METHOD(HttpUtil, matchEtag);
PHP_METHOD(HttpUtil, parseHeaders);
PHP_METHOD(HttpUtil, parseMessage);
+PHP_METHOD(HttpUtil, parseCookie);
PHP_METHOD(HttpUtil, chunkedDecode);
PHP_METHOD(HttpUtil, gzEncode);
PHP_METHOD(HttpUtil, gzDecode);