e0d1e1c07131103a6cac648937d3137e87ae42e1
[m6w6/ext-http] / docs / functions.html
1 <html>
2 <head>
3 <title>Function Summary of ext/http</title>
4 <style>
5 body {
6 font-size: 80%;
7 font-family: sans-serif;
8 }
9 h2, h3 {
10 color: #339;
11 clear: both;
12 font-size: 1.2em;
13 background: #ffc;
14 padding: .2em;
15 }
16 h2.o {
17 color: #66b;
18 clear: both;
19 font-size: 1.3em;
20 background: #f0f0f0;
21 padding: .2em;
22 }
23 p {
24 margin-left: 1em;
25 }
26 pre {
27 font-size: 1.2em;
28 }
29 br {
30 display: none;
31 }
32 blockquote {
33 margin-bottom: 3em;
34 border: 1px solid #ccc;
35 background: #f0f0f0;
36 padding: 0em 1em;
37 width: auto;
38 float: left;
39 }
40 p, pre {
41 clear: both;
42 }
43 p br, pre code br {
44 display: block;
45 }
46 .toc {
47 position: absolute;
48 top: 10px;
49 right: 10px;
50 width: 300px;
51 height: 95%;
52 overflow: scroll;
53 font-size: .9em;
54 }
55 body>div.toc {
56 position: fixed;
57 }
58 .toc ul {
59 padding-left: 15px;
60 margin-left: 0;
61 }
62 .toc li {
63 padding: 0;
64 margin: 0;
65 }
66 .tocfile {
67 font-weight: bold;
68 }
69 </style>
70 </head>
71 <body><h1 id="http_functions.c">http_functions.c</h1>
72 <h2 id="http_date">string http_date([int timestamp])</h2>
73 <p>Compose a valid HTTP date regarding RFC 1123<br />
74 looking like: "Wed, 22 Dec 2004 11:34:47 GMT"</p>
75 <p>Accepts an optional unix timestamp as parameter.</p>
76 <p>Returns the HTTP date as string.</p>
77 <h2 id="http_build_url">string http_build_url(mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]])</h2>
78 <p>Build an URL.</p>
79 <p>Expexts (part(s) of) an URL as first parameter in form of a string or assoziative array<br />
80 like parse_url() returns. Accepts an optional second parameter in the same way as the<br />
81 first argument. Accepts an optional third integer parameter, which is a bitmask of<br />
82 binary or'ed HTTP_URL_* constants. The optional fourth parameter will be filled<br />
83 with the results as associative array like parse_url() would return.</p>
84 <p>The parts of the second URL will be merged into the first according to the flags argument.<br />
85 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 />
86 - HTTP_URL_JOIN_PATH: the path of the second url will be merged into the one of the first<br />
87 - HTTP_URL_JOIN_QUERY: the two querystrings will be merged naivly; no replacements are done<br />
88 - HTTP_URL_STRIP_USER: the user part will not appear in the result<br />
89 - HTTP_URL_STRIP_PASS: the password part will not appear in the result<br />
90 - HTTP_URL_STRIP_AUTH: neither the user nor the password part will appear in the result<br />
91 - HTTP_URL_STRIP_PORT: no explicit port will be set in the result<br />
92 - HTTP_URL_STRIP_PATH: the path part will not appear in the result<br />
93 - HTTP_URL_STRIP_QUERY: no query string will be present in the result<br />
94 - HTTP_URL_STRIP_FRAGMENT: no fragment will be present in the result<br />
95 </pre></p>
96 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
97 <span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;ftp://ftp.example.com/pub/files/current/?a=b&amp;a=c<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">http_build_url</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://user@www.example.com/pub/index.php?a=b#files"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"scheme"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"ftp"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"host"&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"ftp.example.com"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"path"&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"files/current/"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"query"&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"a=c"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">HTTP_URL_STRIP_AUTH&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">HTTP_URL_JOIN_PATH&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">HTTP_URL_JOIN_QUERY&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">HTTP_URL_STRIP_FRAGMENT<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span><br />
98 </span></code></blockquote></p>
99 <p></pre><br />
100 Returns the new URL as string on success or FALSE on failure.</p>
101 <h2 id="http_build_str">string http_build_str(array query [, string prefix[, string arg_separator]])</h2>
102 <p>Opponent to parse_str().</p>
103 <p>Expects an array as first argument which represents the parts of the query string to build.<br />
104 Accepts a string as optional second parameter containing a top-level prefix to use.<br />
105 The optional third parameter should specify an argument separator to use (by default the<br />
106 INI setting arg_separator.output will be used, or "&" if neither is set).</p>
107 <p>Returns the built query as string on success or FALSE on failure.</p>
108 <h2 id="http_negotiate_language">string http_negotiate_language(array supported[, array &result])</h2>
109 <p>This function negotiates the clients preferred language based on its<br />
110 Accept-Language HTTP header. The qualifier is recognized and languages <br />
111 without qualifier are rated highest. The qualifier will be decreased by<br />
112 10% for partial matches (i.e. matching primary language).</p>
113 <p>Expects an array as parameter containing the supported languages as values.<br />
114 If the optional second parameter is supplied, it will be filled with an<br />
115 array containing the negotiation results.</p>
116 <p>Returns the negotiated language or the default language (i.e. first array entry) <br />
117 if none match.</p>
118 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
119 <span style="color: #0000BB">&lt;?php<br />$langs&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'en-US'</span><span style="color: #007700">,</span><span style="color: #FF8000">//&nbsp;default<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'fr'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'fr-FR'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'de'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'de-DE'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'de-AT'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'de-CH'</span><span style="color: #007700">,<br />);<br /><br />include&nbsp;</span><span style="color: #DD0000">'./langs/'</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">http_negotiate_language</span><span style="color: #007700">(</span><span style="color: #0000BB">$langs</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;.</span><span style="color: #DD0000">'.php'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span><br />
120 </span></code></blockquote></p>
121 <p></pre></p>
122 <h2 id="http_negotiate_charset">string http_negotiate_charset(array supported[, array &result])</h2>
123 <p>This function negotiates the clients preferred charset based on its<br />
124 Accept-Charset HTTP header. The qualifier is recognized and charsets <br />
125 without qualifier are rated highest.</p>
126 <p>Expects an array as parameter containing the supported charsets as values.<br />
127 If the optional second parameter is supplied, it will be filled with an<br />
128 array containing the negotiation results.</p>
129 <p>Returns the negotiated charset or the default charset (i.e. first array entry) <br />
130 if none match.</p>
131 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
132 <span style="color: #0000BB">&lt;?php<br />$charsets&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'iso-8859-1'</span><span style="color: #007700">,&nbsp;</span><span style="color: #FF8000">//&nbsp;default<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'iso-8859-2'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'iso-8859-15'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'utf-8'<br /></span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$pref&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">http_negotiate_charset</span><span style="color: #007700">(</span><span style="color: #0000BB">$charsets</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br />if&nbsp;(</span><span style="color: #0000BB">strcmp</span><span style="color: #007700">(</span><span style="color: #0000BB">$pref</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'iso-8859-1'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">iconv_set_encoding</span><span style="color: #007700">(</span><span style="color: #DD0000">'internal_encoding'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'iso-8859-1'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">iconv_set_encoding</span><span style="color: #007700">(</span><span style="color: #DD0000">'output_encoding'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$pref</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ob_start</span><span style="color: #007700">(</span><span style="color: #DD0000">'ob_iconv_handler'</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span><br />
133 </span></code></blockquote></p>
134 <p></pre></p>
135 <h2 id="http_negotiate_content_type">string http_negotiate_ctype(array supported[, array &result])</h2>
136 <p>This function negotiates the clients preferred content type based on its<br />
137 Accept HTTP header. The qualifier is recognized and content types <br />
138 without qualifier are rated highest.</p>
139 <p>Expects an array as parameter containing the supported content types as values.<br />
140 If the optional second parameter is supplied, it will be filled with an<br />
141 array containing the negotiation results.</p>
142 <p>Returns the negotiated content type or the default content type <br />
143 (i.e. first array entry) if none match.</p>
144 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
145 <span style="color: #0000BB">&lt;?php<br />$ctypes&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'application/xhtml+xml'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'text/html'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">http_send_content_type</span><span style="color: #007700">(</span><span style="color: #0000BB">http_negotiate_content_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctypes</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span><br />
146 </span></code></blockquote></p>
147 <p></pre></p>
148 <h2 id="http_send_status">bool http_send_status(int status)</h2>
149 <p>Send HTTP status code.</p>
150 <p>Expects an HTTP status code as parameter.</p>
151 <p>Returns TRUE on success or FALSE on failure.</p>
152 <h2 id="http_send_last_modified">bool http_send_last_modified([int timestamp])</h2>
153 <p>Send a "Last-Modified" header with a valid HTTP date.</p>
154 <p>Accepts a unix timestamp, converts it to a valid HTTP date and<br />
155 sends it as "Last-Modified" HTTP header. If timestamp is<br />
156 omitted, the current time will be sent.</p>
157 <p>Returns TRUE on success or FALSE on failure.</p>
158 <h2 id="http_send_content_type">bool http_send_content_type([string content_type = 'application/x-octetstream'])</h2>
159 <p>Send the Content-Type of the sent entity. This is particularly important<br />
160 if you use the http_send() API.</p>
161 <p>Accepts an optional string parameter containing the desired content type <br />
162 (primary/secondary).</p>
163 <p>Returns TRUE on success or FALSE on failure.</p>
164 <h2 id="http_send_content_disposition">bool http_send_content_disposition(string filename[, bool inline = false])</h2>
165 <p>Send the Content-Disposition. The Content-Disposition header is very useful<br />
166 if the data actually sent came from a file or something similar, that should<br />
167 be "saved" by the client/user (i.e. by browsers "Save as..." popup window).</p>
168 <p>Expects a string parameter specifying the file name the "Save as..." dialog<br />
169 should display. Optionally accepts a bool parameter, which, if set to true<br />
170 and the user agent knows how to handle the content type, will probably not<br />
171 cause the popup window to be shown.</p>
172 <p>Returns TRUE on success or FALSE on failure.</p>
173 <h2 id="http_match_modified">bool http_match_modified([int timestamp[, bool for_range = false]])</h2>
174 <p>Matches the given unix timestamp against the clients "If-Modified-Since" <br />
175 resp. "If-Unmodified-Since" HTTP headers.</p>
176 <p>Accepts a unix timestamp which should be matched. Optionally accepts an<br />
177 additional bool parameter, which if set to true will check the header <br />
178 usually used to validate HTTP ranges. If timestamp is omitted, the<br />
179 current time will be used.</p>
180 <p>Returns TRUE if timestamp represents an earlier date than the header,<br />
181 else FALSE.</p>
182 <h2 id="http_match_etag">bool http_match_etag(string etag[, bool for_range = false])</h2>
183 <p>Matches the given ETag against the clients "If-Match" resp. <br />
184 "If-None-Match" HTTP headers.</p>
185 <p>Expects a string parameter containing the ETag to compare. Optionally<br />
186 accepts a bool parameter, which, if set to true, will check the header<br />
187 usually used to validate HTTP ranges.</p>
188 <p>Returns TRUE if ETag matches or the header contained the asterisk ("*"),<br />
189 else FALSE.</p>
190 <h2 id="http_cache_last_modified">bool http_cache_last_modified([int timestamp_or_expires]])</h2>
191 <p>Attempts to cache the sent entity by its last modification date.</p>
192 <p>Accepts a unix timestamp as parameter which is handled as follows:</p>
193 <p>If timestamp_or_expires is greater than 0, it is handled as timestamp<br />
194 and will be sent as date of last modification. If it is 0 or omitted,<br />
195 the current time will be sent as Last-Modified date. If it's negative,<br />
196 it is handled as expiration time in seconds, which means that if the<br />
197 requested last modification date is not between the calculated timespan,<br />
198 the Last-Modified header is updated and the actual body will be sent.</p>
199 <p>Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.</p>
200 <p>A log entry will be written to the cache log if the INI entry<br />
201 http.cache_log is set and the cache attempt was successful.</p>
202 <h2 id="http_cache_etag">bool http_cache_etag([string etag])</h2>
203 <p>Attempts to cache the sent entity by its ETag, either supplied or generated <br />
204 by the hash algorithm specified by the INI setting "http.etag_mode".</p>
205 <p>If the clients "If-None-Match" header matches the supplied/calculated<br />
206 ETag, the body is considered cached on the clients side and<br />
207 a "304 Not Modified" status code is issued.</p>
208 <p>Returns FALSE on failure, or *exits* with "304 Not Modified" if the entity is cached.</p>
209 <p>A log entry is written to the cache log if the INI entry<br />
210 "http.cache_log" is set and the cache attempt was successful.</p>
211 <h2 id="ob_etaghandler">string ob_etaghandler(string data, int mode)</h2>
212 <p>For use with ob_start(). Output buffer handler generating an ETag with<br />
213 the hash algorithm specified with the INI setting "http.etag_mode".</p>
214 <h2 id="http_throttle">void http_throttle(double sec[, int bytes = 40960])</h2>
215 <p>Sets the throttle delay and send buffer size for use with http_send() API.<br />
216 Provides a basic throttling mechanism, which will yield the current process<br />
217 resp. thread until the entity has been completely sent, though.</p>
218 <p>Expects a double parameter specifying the seconds too sleep() after<br />
219 each chunk sent. Additionally accepts an optional int parameter<br />
220 representing the chunk size in bytes.</p>
221 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
222 <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;~&nbsp;20&nbsp;kbyte/s<br />#&nbsp;http_throttle(1,&nbsp;20000);<br />#&nbsp;http_throttle(0.5,&nbsp;10000);<br />#&nbsp;http_throttle(0.1,&nbsp;2000);<br /></span><span style="color: #0000BB">http_send_file</span><span style="color: #007700">(</span><span style="color: #DD0000">'document.pdf'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span><br />
223 </span></code></blockquote></p>
224 <p></pre></p>
225 <h2 id="http_redirect">void http_redirect([string url[, array params[, bool session = false[, int status = 302]]]])</h2>
226 <p>Redirect to the given url.<br />
227 <br />
228 The supplied url will be expanded with http_build_url(), the params array will<br />
229 be treated with http_build_query() and the session identification will be appended<br />
230 if session is true.</p>
231 <p>The HTTP response code will be set according to status.<br />
232 You can use one of the following constants for convenience:<br />
233 - HTTP_REDIRECT 302 Found for GET/HEAD, else 303 See Other<br />
234 - HTTP_REDIRECT_PERM 301 Moved Permanently<br />
235 - HTTP_REDIRECT_FOUND 302 Found<br />
236 - HTTP_REDIRECT_POST 303 See Other<br />
237 - HTTP_REDIRECT_PROXY 305 Use Proxy<br />
238 - HTTP_REDIRECT_TEMP 307 Temporary Redirect</p>
239 <p>Please see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3<br />
240 for which redirect response code to use in which situation.</p>
241 <p>To be RFC compliant, "Redirecting to <a>URL</a>." will be displayed,<br />
242 if the client doesn't redirect immediately, and the request method was<br />
243 another one than HEAD.</p>
244 <p>Returns FALSE on failure, or *exits* on success.</p>
245 <p>A log entry will be written to the redirect log, if the INI entry<br />
246 "http.redirect_log" is set and the redirect attempt was successful.</p>
247 <h2 id="http_send_data">bool http_send_data(string data)</h2>
248 <p>Sends raw data with support for (multiple) range requests.</p>
249 <p>Returns TRUE on success, or FALSE on failure.</p>
250 <h2 id="http_send_file">bool http_send_file(string file)</h2>
251 <p>Sends a file with support for (multiple) range requests.</p>
252 <p>Expects a string parameter referencing the file to send.</p>
253 <p>Returns TRUE on success, or FALSE on failure.</p>
254 <h2 id="http_send_stream">bool http_send_stream(resource stream)</h2>
255 <p>Sends an already opened stream with support for (multiple) range requests.</p>
256 <p>Expects a resource parameter referencing the stream to read from.</p>
257 <p>Returns TRUE on success, or FALSE on failure.</p>
258 <h2 id="http_chunked_decode">string http_chunked_decode(string encoded)</h2>
259 <p>Decodes a string that was HTTP-chunked encoded.</p>
260 <p>Expects a chunked encoded string as parameter.</p>
261 <p>Returns the decoded string on success or FALSE on failure.</p>
262 <h2 id="http_parse_message">object http_parse_message(string message)</h2>
263 <p>Parses (a) http_message(s) into a simple recursive object structure.</p>
264 <p>Expects a string parameter containing a single HTTP message or<br />
265 several consecutive HTTP messages.</p>
266 <p>Returns an hierarchical object structure of the parsed messages.</p>
267 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
268 <span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">http_parse_message</span><span style="color: #007700">(</span><span style="color: #0000BB">http_get</span><span style="color: #007700">(</span><span style="color: #0000BB">URL</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'redirect'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3</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">type</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">2<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">httpVersion</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">1.1<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">responseCode</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">200<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">headers</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;Array&nbsp;<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">Content</span><span style="color: #007700">-</span><span style="color: #0000BB">Length</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">Server</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">Apache<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">body</span><span style="color: #007700">]&nbsp;&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">Hi</span><span style="color: #007700">!<br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">parentMessage</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">stdClass&nbsp;object<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">type</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">2<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">httpVersion</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">1.1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">responseCode</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">302<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">headers</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;Array&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">Content</span><span style="color: #007700">-</span><span style="color: #0000BB">Length</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">Location</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">body</span><span style="color: #007700">]&nbsp;&nbsp;=&gt;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">parentMessage</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;)<br />)<br /></span><span style="color: #0000BB">?&gt;</span><br />
269 </span></code></blockquote></p>
270 <p></pre></p>
271 <h2 id="http_parse_headers">array http_parse_headers(string header)</h2>
272 <p>Parses HTTP headers into an associative array.</p>
273 <p>Expects a string parameter containing HTTP headers.</p>
274 <p>Returns an array on success, or FALSE on failure.</p>
275 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
276 <span style="color: #0000BB">&lt;?php<br />$headers&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"content-type:&nbsp;text/html;&nbsp;charset=UTF-8\r\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"Server:&nbsp;Funky/1.0\r\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"Set-Cookie:&nbsp;foo=bar\r\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"Set-Cookie:&nbsp;baz=quux\r\n"</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"Folded:&nbsp;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 />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">Content</span><span style="color: #007700">-</span><span style="color: #0000BB">Type</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">/</span><span style="color: #0000BB">html</span><span style="color: #007700">;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">[</span><span style="color: #0000BB">Server</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">Funky</span><span style="color: #007700">/</span><span style="color: #0000BB">1.0<br />&nbsp;&nbsp;&nbsp;&nbsp;</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">]&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">0</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">=</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">1</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">baz</span><span style="color: #007700">=</span><span style="color: #0000BB">quux<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;[</span><span style="color: #0000BB">Folded</span><span style="color: #007700">]&nbsp;=&gt;&nbsp;</span><span style="color: #0000BB">works<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;too&nbsp;<br /></span><span style="color: #007700">)&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span><br />
277 </span></code></blockquote></p>
278 <p></pre></p>
279 <h2 id="http_parse_cookie">object http_parse_cookie(string cookie[, int flags[, array allowed_extras]])</h2>
280 <p>Parses HTTP cookies like sent in a response into a struct.</p>
281 <p>Expects a string as parameter containing the value of a Set-Cookie response header.</p>
282 <p>Returns an stdClass olike shown in the example on success or FALSE on failure.</p>
283 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
284 <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 />
285 </span></code></blockquote></p>
286 <p></pre></p>
287 <h2 id="http_get_request_headers">array http_get_request_headers(void)</h2>
288 <p>Get a list of incoming HTTP headers.</p>
289 <p>Returns an associative array of incoming request headers.</p>
290 <h2 id="http_get_request_body">string http_get_request_body(void)</h2>
291 <p>Get the raw request body (e.g. POST or PUT data).</p>
292 <p>This function can not be used after http_get_request_body_stream() <br />
293 if the request method was another than POST.</p>
294 <p>Returns the raw request body as string on success or NULL on failure.</p>
295 <h2 id="http_get_request_body_stream">resource http_get_request_body_stream(void)</h2>
296 <p>Create a stream to read the raw request body (e.g. POST or PUT data).</p>
297 <p>This function can only be used once if the request method was another than POST.</p>
298 <p>Returns the raw request body as stream on success or NULL on failure.</p>
299 <h2 id="http_match_request_header">bool http_match_request_header(string header, string value[, bool match_case = false])</h2>
300 <p>Match an incoming HTTP header.</p>
301 <p>Expects two string parameters representing the header name (case-insensitive)<br />
302 and the header value that should be compared. The case sensitivity of the<br />
303 header value depends on the additional optional bool parameter accepted.</p>
304 <p>Returns TRUE if header value matches, else FALSE.</p>
305 <h2 id="http_get">string http_get(string url[, array options[, array &info]])</h2>
306 <p>Performs an HTTP GET request on the supplied url.</p>
307 <p>The second parameter, if set, is expected to be an associative<br />
308 array where the following keys will be recognized:</p><pre> - redirect: int, whether and how many redirects to follow<br />
309 - unrestrictedauth: bool, whether to continue sending credentials on<br />
310 redirects to a different host<br />
311 - proxyhost: string, proxy host in "host[:port]" format<br />
312 - proxyport: int, use another proxy port as specified in proxyhost<br />
313 - proxytype: int, HTTP_PROXY_HTTP, SOCKS4 or SOCKS5<br />
314 - proxyauth: string, proxy credentials in "user:pass" format<br />
315 - proxyauthtype: int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM<br />
316 - httpauth: string, http credentials in "user:pass" format<br />
317 - httpauthtype: int, HTTP_AUTH_BASIC, DIGEST and/or NTLM<br />
318 - compress: bool, whether to allow gzip/deflate content encoding<br />
319 - port: int, use another port as specified in the url<br />
320 - referer: string, the referer to send<br />
321 - useragent: string, the user agent to send<br />
322 (defaults to PECL::HTTP/version (PHP/version)))<br />
323 - headers: array, list of custom headers as associative array<br />
324 like array("header" => "value")<br />
325 - cookies: array, list of cookies as associative array<br />
326 like array("cookie" => "value")<br />
327 - encodecookies: bool, whether to urlencode the cookies (default: true)<br />
328 - resetcookies: bool, wheter to reset the cookies<br />
329 - cookiestore: string, path to a file where cookies are/will be stored<br />
330 - cookiesession: bool, accept (true) or reset (false) sessioncookies<br />
331 - resume: int, byte offset to start the download from;<br />
332 if the server supports ranges<br />
333 - range: array, array of arrays, each containing two integers,<br />
334 specifying the ranges to download if server support is<br />
335 given; only recognized if the resume option is empty<br />
336 - maxfilesize: int, maximum file size that should be downloaded;<br />
337 has no effect, if the size of the requested entity is not known<br />
338 - lastmodified: int, timestamp for If-(Un)Modified-Since header<br />
339 - etag: string, quoted etag for If-(None-)Match header<br />
340 - timeout: int, seconds the request may take<br />
341 - connecttimeout: int, seconds the connect may take<br />
342 - onprogress: mixed, progress callback<br />
343 - interface: string, outgoing network interface (ifname, ip or hostname)<br />
344 - portrange: array, 2 integers specifying outgoing portrange to try<br />
345 - ssl: array, with the following options:<br />
346 cert: string, path to certificate<br />
347 certtype: string, type of certificate<br />
348 certpasswd: string, password for certificate<br />
349 key: string, path to key<br />
350 keytype: string, type of key<br />
351 keypasswd: string, pasword for key<br />
352 engine: string, ssl engine to use<br />
353 version: int, ssl version to use<br />
354 verifypeer: bool, whether to verify the peer<br />
355 verifyhost: bool whether to verify the host<br />
356 cipher_list: string, list of allowed ciphers<br />
357 cainfo: string<br />
358 capath: string<br />
359 random_file: string<br />
360 egdsocket: string<br />
361 </pre></p>
362 <p>The optional third parameter will be filled with some additional information<br />
363 in form of an associative array, if supplied, like the following example:</p><pre><blockquote><code><span style="color: #000000"><br />
364 <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">array&nbsp;(<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'effective_url'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'http://www.example.com/'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'response_code'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">302</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'connect_code'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'filetime'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;-</span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'total_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0.212348</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'namelookup_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0.038296</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'connect_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0.104144</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'pretransfer_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0.104307</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'starttransfer_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0.212077</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'redirect_time'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'redirect_count'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'size_upload'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'size_download'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">218</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'speed_download'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">1026</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'speed_upload'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'header_size'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">307</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'request_size'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">103</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'ssl_verifyresult'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'ssl_engines'&nbsp;</span><span style="color: #007700">=&gt;<br />&nbsp;&nbsp;&nbsp;array&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">0&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'dynamic'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'cswift'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">2&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'chil'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">3&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'atalla'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">4&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'nuron'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">5&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'ubsec'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">6&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'aep'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">7&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'sureware'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">8&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'4758cca'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'content_length_download'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">218</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'content_length_upload'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'content_type'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'text/html'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'httpauth_avail'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'proxyauth_avail'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'num_connects'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'os_errno'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'error'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">,<br />&nbsp;)<br /></span><span style="color: #0000BB">?&gt;</span><br />
365 </span></code></blockquote></p>
366 <p></pre></p>
367 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
368 <h2 id="http_head">string http_head(string url[, array options[, array &info]])</h2>
369 <p>Performs an HTTP HEAD request on the supplied url.</p>
370 <p>See http_get() for a full list of available parameters and options.</p>
371 <p>Returns the HTTP response as string on success, or FALSE on failure.</p>
372 <h2 id="http_post_data">string http_post_data(string url, string data[, array options[, array &info]])</h2>
373 <p>Performs an HTTP POST request on the supplied url.</p>
374 <p>Expects a string as second parameter containing the pre-encoded post data.<br />
375 See http_get() for a full list of available parameters and options.<br />
376 <br />
377 Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
378 <h2 id="http_post_fields">string http_post_fields(string url, array data[, array files[, array options[, array &info]]])</h2>
379 <p>Performs an HTTP POST request on the supplied url.</p>
380 <p>Expects an associative array as second parameter, which will be<br />
381 www-form-urlencoded. See http_get() for a full list of available options.</p>
382 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
383 <h2 id="http_put_file">string http_put_file(string url, string file[, array options[, array &info]])</h2>
384 <p>Performs an HTTP PUT request on the supplied url.</p>
385 <p>Expects the second parameter to be a string referencing the file to upload.<br />
386 See http_get() for a full list of available options.</p>
387 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
388 <h2 id="http_put_stream">string http_put_stream(string url, resource stream[, array options[, array &info]])</h2>
389 <p>Performs an HTTP PUT request on the supplied url.</p>
390 <p>Expects the second parameter to be a resource referencing an already <br />
391 opened stream, from which the data to upload should be read.<br />
392 See http_get() for a full list of available options.</p>
393 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
394 <h2 id="http_put_data">string http_put_data(string url, string data[, array options[, array &info]])</h2>
395 <p>Performs an HTTP PUT request on the supplied url.</p>
396 <p>Expects the second parameter to be a string containing the data to upload.<br />
397 See http_get() for a full list of available options.</p>
398 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
399 <h2 id="http_request">string http_request(int method, string url[, string body[, array options[, array &info]]])</h2>
400 <p>Performs a custom HTTP request on the supplied url.</p>
401 <p>Expects the first parameter to be an integer specifying the request method to use.<br />
402 Accepts an optional third string parameter containing the raw request body.<br />
403 See http_get() for a full list of available options.</p>
404 <p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p>
405 <h2 id="http_request_body_encode">string http_request_body_encode(array fields, array files)</h2>
406 <p>Generate x-www-form-urlencoded resp. form-data encoded request body.</p>
407 <p>Returns encoded string on success, or FALSE on failure.</p>
408 <h2 id="http_request_method_register">int http_request_method_register(string method)</h2>
409 <p>Register a custom request method.</p>
410 <p>Expects a string parameter containing the request method name to register.</p>
411 <p>Returns the ID of the request method on success, or FALSE on failure.</p>
412 <h2 id="http_request_method_unregister">bool http_request_method_unregister(mixed method)</h2>
413 <p>Unregister a previously registered custom request method.</p>
414 <p>Expects either the request method name or ID.</p>
415 <p>Returns TRUE on success, or FALSE on failure.</p>
416 <h2 id="http_request_method_exists">int http_request_method_exists(mixed method)</h2>
417 <p>Check if a request method is registered (or available by default).</p>
418 <p>Expects either the request method name or ID as parameter.</p>
419 <p>Returns TRUE if the request method is known, else FALSE.</p>
420 <h2 id="http_request_method_name">string http_request_method_name(int method)</h2>
421 <p>Get the literal string representation of a standard or registered request method.</p>
422 <p>Expects the request method ID as parameter.</p>
423 <p>Returns the request method name as string on success, or FALSE on failure.</p>
424 <h2 id="http_deflate">string http_deflate(string data[, int flags = 0])</h2>
425 <p>Compress data with gzip, zlib AKA deflate or raw deflate encoding.</p>
426 <p>Expects the first parameter to be a string containing the data that should<br />
427 be encoded.</p>
428 <p>Returns the encoded string on success, or NULL on failure.</p>
429 <h2 id="http_inflate">string http_inflate(string data)</h2>
430 <p>Decompress data compressed with either gzip, deflate AKA zlib or raw<br />
431 deflate encoding.</p>
432 <p>Expects a string as parameter containing the compressed data.</p>
433 <p>Returns the decoded string on success, or NULL on failure.</p>
434 <h2 id="ob_deflatehandler">string ob_deflatehandler(string data, int mode)</h2>
435 <p>For use with ob_start(). The deflate output buffer handler can only be used once.<br />
436 It conflicts with ob_gzhandler and zlib.output_compression as well and should<br />
437 not be used after ext/mbstrings mb_output_handler and ext/sessions URL-Rewriter (AKA<br />
438 session.use_trans_sid).</p>
439 <h2 id="ob_inflatehandler">string ob_inflatehandler(string data, int mode)</h2>
440 <p>For use with ob_start(). Same restrictions as with ob_deflatehandler apply.</p>
441 <h2 id="http_support">int http_support([int feature = 0])</h2>
442 <p>Check for feature that require external libraries.</p>
443 <p>Accepts an optional in parameter specifying which feature to probe for.<br />
444 If the parameter is 0 or omitted, the return value contains a bitmask of <br />
445 all supported features that depend on external libraries.</p>
446 <p>Available features to probe for are:<br />
447 <ul> <br />
448 <li> HTTP_SUPPORT: always set<br />
449 <li> HTTP_SUPPORT_REQUESTS: whether ext/http was linked against libcurl,<br />
450 and HTTP requests can be issued<br />
451 <li> HTTP_SUPPORT_SSLREQUESTS: whether libcurl was linked against openssl,<br />
452 and SSL requests can be issued <br />
453 <li> HTTP_SUPPORT_ENCODINGS: whether ext/http was linked against zlib,<br />
454 and compressed HTTP responses can be decoded<br />
455 <li> HTTP_SUPPORT_MAGICMIME: whether ext/http was linked against libmagic,<br />
456 and the HttpResponse::guessContentType() method is usable<br />
457 </ul></p>
458 <p>Returns int, whether requested feature is supported, or a bitmask with<br />
459 all supported features.</p>
460 <hr noshade>
461 <h1 id="http_deflatestream_object.c">http_deflatestream_object.c</h1>
462 <h2 id="HttpDeflateStream" class="o">HttpDeflateStream</h2>
463 <h3 id="HttpDeflateStream___construct">void HttpDeflateStream::__construct([int flags = 0])</h3>
464 <p>Creates a new HttpDeflateStream object instance.</p>
465 <p>Accepts an optional int parameter specifying how to initialize the deflate stream.</p>
466 <h3 id="HttpDeflateStream_update">string HttpDeflateStream::update(string data)</h3>
467 <p>Passes more data through the deflate stream.</p>
468 <p>Expects a string parameter containing (a part of) the data to deflate.</p>
469 <p>Returns deflated data on success or FALSE on failure.</p>
470 <h3 id="HttpDeflateStream_flush">string HttpDeflateStream::flush([string data])</h3>
471 <p>Flushes the deflate stream.</p>
472 <p>Returns some deflated data as string on success or FALSE on failure.</p>
473 <h3 id="HttpDeflateStream_finish">string HttpDeflateStream::finish([string data])</h3>
474 <p>Finalizes the deflate stream. The deflate stream can be reused after finalizing.</p>
475 <p>Returns the final part of deflated data.</p>
476 <hr noshade>
477 <h1 id="http_inflatestream_object.c">http_inflatestream_object.c</h1>
478 <h2 id="HttpInflateStream" class="o">HttpInflateStream</h2>
479 <h3 id="HttpInflateStream_update">string HttpInflateStream::update(string data)</h3>
480 <p>Passes more data through the inflate stream.</p>
481 <p>Expects a string parameter containing (a part of) the data to inflate.</p>
482 <p>Returns inflated data on success or FALSE on failure.</p>
483 <h3 id="HttpInflateStream_flush">string HttpInflateStream::flush([string data])</h3>
484 <p>Flush the inflate stream.</p>
485 <p>Returns some inflated data as string on success or FALSE on failure.</p>
486 <h3 id="HttpInflateStream_finish">string HttpInflateStream::finish([string data])</h3>
487 <p>Finalizes the inflate stream. The inflate stream can be reused after finalizing.</p>
488 <p>Returns the final part of inflated data.</p>
489 <hr noshade>
490 <h1 id="http_message_object.c">http_message_object.c</h1>
491 <h2 id="HttpMessage" class="o">HttpMessage</h2>
492 <h3 id="HttpMessage___construct">void HttpMessage::__construct([string message])</h3>
493 <p>Instantiate a new HttpMessage object.</p>
494 <p>Accepts an optional string parameter containing a single or several <br />
495 consecutive HTTP messages. The constructed object will actually <br />
496 represent the *last* message of the passed string. If there were<br />
497 prior messages, those can be accessed by HttpMessage::getParentMessage().</p>
498 <p>Throws HttpMalformedHeaderException.</p>
499 <h3 id="HttpMessage_fromString">static HttpMessage HttpMessage::fromString(string raw_message[, string class_name = "HttpMessage"])</h3>
500 <p>Create an HttpMessage object from a string. Kind of a static constructor.</p>
501 <p>Expects a string parameter containing a single or several consecutive<br />
502 HTTP messages. Accepts an optional string parameter specifying the class to use.</p>
503 <p>Returns an HttpMessage object on success or NULL on failure.</p>
504 <p>Throws HttpMalformedHeadersException.</p>
505 <h3 id="HttpMessage_getBody">string HttpMessage::getBody()</h3>
506 <p>Get the body of the parsed HttpMessage.</p>
507 <p>Returns the message body as string.</p>
508 <h3 id="HttpMessage_setBody">void HttpMessage::setBody(string body)</h3>
509 <p>Set the body of the HttpMessage.<br />
510 NOTE: Don't forget to update any headers accordingly.</p>
511 <p>Expects a string parameter containing the new body of the message.</p>
512 <h3 id="HttpMessage_getHeaders">array HttpMessage::getHeaders()</h3>
513 <p>Get Message Headers.</p>
514 <p>Returns an associative array containing the messages HTTP headers.</p>
515 <h3 id="HttpMessage_setHeaders">void HttpMessage::setHeaders(array headers)</h3>
516 <p>Sets new headers.</p>
517 <p>Expects an associative array as parameter containing the new HTTP headers,<br />
518 which will replace *all* previous HTTP headers of the message.</p>
519 <h3 id="HttpMessage_addHeaders">void HttpMessage::addHeaders(array headers[, bool append = false])</h3>
520 <p>Add headers. If append is true, headers with the same name will be separated, else overwritten.</p>
521 <p>Expects an associative array as parameter containing the additional HTTP headers<br />
522 to add to the messages existing headers. If the optional bool parameter is true,<br />
523 and a header with the same name of one to add exists already, this respective<br />
524 header will be converted to an array containing both header values, otherwise<br />
525 it will be overwritten with the new header value.</p>
526 <h3 id="HttpMessage_getType">int HttpMessage::getType()</h3>
527 <p>Get Message Type. (HTTP_MSG_NONE|HTTP_MSG_REQUEST|HTTP_MSG_RESPONSE)</p>
528 <p>Returns the HttpMessage::TYPE.</p>
529 <h3 id="HttpMessage_setType">void HttpMessage::setType(int type)</h3>
530 <p>Set Message Type. (HTTP_MSG_NONE|HTTP_MSG_REQUEST|HTTP_MSG_RESPONSE)</p>
531 <p>Expects an int parameter, the HttpMessage::TYPE.</p>
532 <h3 id="HttpMessage_getResponseCode">int HttpMessage::getResponseCode()</h3>
533 <p>Get the Response Code of the Message.</p>
534 <p>Returns the HTTP response code if the message is of type <br />
535 HttpMessage::TYPE_RESPONSE, else FALSE.</p>
536 <h3 id="HttpMessage_setResponseCode">bool HttpMessage::setResponseCode(int code)</h3>
537 <p>Set the response code of an HTTP Response Message.</p>
538 <p>Expects an int parameter with the HTTP response code.</p>
539 <p>Returns TRUE on success, or FALSE if the message is not of type<br />
540 HttpMessage::TYPE_RESPONSE or the response code is out of range (100-510).</p>
541 <h3 id="HttpMessage_getResponseStatus">string HttpMessage::getResponseStatus()</h3>
542 <p>Get the Response Status of the message (i.e. the string following the response code).</p>
543 <p>Returns the HTTP response status string if the message is of type <br />
544 HttpMessage::TYPE_RESPONSE, else FALSE.</p>
545 <h3 id="HttpMessage_setResponseStatus">bool HttpMessage::setResponseStatus(string status)</h3>
546 <p>Set the Response Status of the HTTP message (i.e. the string following the response code).</p>
547 <p>Expects a string parameter containing the response status text.</p>
548 <p>Returns TRUE on success or FALSE if the message is not of type<br />
549 HttpMessage::TYPE_RESPONSE.</p>
550 <h3 id="HttpMessage_getRequestMethod">string HttpMessage::getRequestMethod()</h3>
551 <p>Get the Request Method of the Message.</p>
552 <p>Returns the request method name on success, or FALSE if the message is<br />
553 not of type HttpMessage::TYPE_REQUEST.</p>
554 <h3 id="HttpMessage_setRequestMethod">bool HttpMessage::setRequestMethod(string method)</h3>
555 <p>Set the Request Method of the HTTP Message.</p>
556 <p>Expects a string parameter containing the request method name.</p>
557 <p>Returns TRUE on success, or FALSE if the message is not of type<br />
558 HttpMessage::TYPE_REQUEST or an invalid request method was supplied.</p>
559 <h3 id="HttpMessage_getRequestUrl">string HttpMessage::getRequestUrl()</h3>
560 <p>Get the Request URL of the Message.</p>
561 <p>Returns the request url as string on success, or FALSE if the message<br />
562 is not of type HttpMessage::TYPE_REQUEST.</p>
563 <h3 id="HttpMessage_setRequestUrl">bool HttpMessage::setRequestUrl(string url)</h3>
564 <p>Set the Request URL of the HTTP Message.</p>
565 <p>Expects a string parameters containing the request url.</p>
566 <p>Returns TRUE on success, or FALSE if the message is not of type<br />
567 HttpMessage::TYPE_REQUEST or supplied URL was empty.</p>
568 <h3 id="HttpMessage_getHttpVersion">string HttpMessage::getHttpVersion()</h3>
569 <p>Get the HTTP Protocol Version of the Message.</p>
570 <p>Returns the HTTP protocol version as string.</p>
571 <h3 id="HttpMessage_setHttpVersion">bool HttpMessage::setHttpVersion(string version)</h3>
572 <p>Set the HTTP Protocol version of the Message.</p>
573 <p>Expects a string parameter containing the HTTP protocol version.</p>
574 <p>Returns TRUE on success, or FALSE if supplied version is out of range (1.0/1.1).</p>
575 <h3 id="HttpMessage_getParentMessage">HttpMessage HttpMessage::getParentMessage()</h3>
576 <p>Get parent Message.</p>
577 <p>Returns the parent HttpMessage on success, or NULL if there's none.</p>
578 <p>Throws HttpRuntimeException.</p>
579 <h3 id="HttpMessage_send">bool HttpMessage::send()</h3>
580 <p>Send the Message according to its type as Response or Request.<br />
581 This provides limited functionality compared to HttpRequest and HttpResponse.</p>
582 <p>Returns TRUE on success, or FALSE on failure.</p>
583 <h3 id="HttpMessage_toString">string HttpMessage::toString([bool include_parent = false])</h3>
584 <p>Get the string representation of the Message.</p>
585 <p>Accepts a bool parameter which specifies whether the returned string<br />
586 should also contain any parent messages.</p>
587 <p>Returns the full message as string.</p>
588 <h3 id="HttpMessage_toMessageTypeObject">HttpRequest|HttpResponse HttpMessage::toMessageTypeObject(void)</h3>
589 <p>Creates an object regarding to the type of the message.</p>
590 <p>Returns either an HttpRequest or HttpResponse object on success, or NULL on failure.</p>
591 <p>Throws HttpRuntimeException, HttpMessageTypeException, HttpHeaderException.</p>
592 <h3 id="HttpMessage_count">int HttpMessage::count()</h3>
593 <p>Implements Countable.</p>
594 <p>Returns the number of parent messages + 1.</p>
595 <h3 id="HttpMessage_serialize">string HttpMessage::serialize()</h3>
596 <p>Implements Serializable.</p>
597 <p>Returns the serialized representation of the HttpMessage.</p>
598 <h3 id="HttpMessage_unserialize">void HttpMessage::unserialize(string serialized)</h3>
599 <p>Implements Serializable.</p>
600 <p>Re-constructs the HttpMessage based upon the serialized string.</p>
601 <h3 id="HttpMessage_detach">HttpMessage HttpMessage::detach(void)</h3>
602 <p>Returns a clone of an HttpMessage object detached from any parent messages.</p>
603 <h3 id="HttpMessage_prepend">void HttpMessage::prepend(HttpMessage message[, bool top = true])</h3>
604 <p>Prepends message(s) to the HTTP message.</p>
605 <p>Expects an HttpMessage object as parameter.</p>
606 <p>Throws HttpInvalidParamException if the message is located within the same message chain.</p>
607 <h3 id="HttpMessage_reverse">HttpMessage HttpMessage::reverse()</h3>
608 <p>Reorders the message chain in reverse order.</p>
609 <p>Returns the most parent HttpMessage object.</p>
610 <h3 id="HttpMessage_rewind">void HttpMessage::rewind(void)</h3>
611 <p>Implements Iterator.</p>
612 <h3 id="HttpMessage_valid">bool HttpMessage::valid(void)</h3>
613 <p>Implements Iterator.</p>
614 <h3 id="HttpMessage_next">void HttpMessage::next(void)</h3>
615 <p>Implements Iterator.</p>
616 <h3 id="HttpMessage_key">int HttpMessage::key(void)</h3>
617 <p>Implements Iterator.</p>
618 <h3 id="HttpMessage_current">HttpMessage HttpMessage::current(void)</h3>
619 <p>Implements Iterator.</p>
620 <hr noshade>
621 <h1 id="http_querystring_object.c">http_querystring_object.c</h1>
622 <h2 id="HttpQueryString" class="o">HttpQueryString</h2>
623 <h3 id="HttpQueryString___construct">final void HttpQueryString::__construct([bool global = true[, mixed add])</h3>
624 <p>Creates a new HttpQueryString object instance.<br />
625 Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.</p>
626 <h3 id="HttpQueryString_toString">string HttpQueryString::toString()</h3>
627 <p>Returns the string representation.</p>
628 <h3 id="HttpQueryString_toArray">array HttpQueryString::toArray()</h3>
629 <p>Returns the array representation.</p>
630 <h3 id="HttpQueryString_get">mixed HttpQueryString::get([string key[, mixed type = 0[, mixed defval = NULL[, bool delete = false]]]])</h3>
631 <p>Get (part of) the query string.</p>
632 <p>The type parameter is either one of the HttpQueryString::TYPE_* constants or a type abbreviation like<br />
633 "b" for bool, "i" for int, "f" for float, "s" for string, "a" for array and "o" for a stdClass object.</p>
634 <h3 id="HttpQueryString_set">string HttpQueryString::set(mixed params)</h3>
635 <p>Set query string entry/entries. NULL values will unset the variable.</p>
636 <h3 id="HttpQueryString_singleton">static HttpQueryString HttpQueryString::singleton([bool global = true])</h3>
637 <p>Get a single instance (differentiates between the global setting).</p>
638 <h3 id="HttpQueryString_xlate">bool HttpQueryString::xlate(string ie, string oe)</h3>
639 <p>Converts the query string from the source encoding ie to the target encoding oe.<br />
640 WARNING: Don't use any character set that can contain NUL bytes like UTF-16.</p>
641 <p>Returns TRUE on success or FALSE on failure.</p>
642 <h3 id="HttpQueryString_serialize">string HttpQueryString::serialize()</h3>
643 <p>Implements Serializable.</p>
644 <h3 id="HttpQueryString_unserialize">void HttpQueryString::unserialize(string serialized)</h3>
645 <p>Implements Serializable.</p>
646 <hr noshade>
647 <h1 id="http_request_object.c">http_request_object.c</h1>
648 <h2 id="HttpRequest" class="o">HttpRequest</h2>
649 <h3 id="HttpRequest___construct">void HttpRequest::__construct([string url[, int request_method = HTTP_METH_GET[, array options]]])</h3>
650 <p>Instantiate a new HttpRequest object.</p>
651 <p>Accepts a string as optional parameter containing the target request url.<br />
652 Additionally accepts an optional int parameter specifying the request method<br />
653 to use and an associative array as optional third parameter which will be<br />
654 passed to HttpRequest::setOptions(). </p>
655 <p>Throws HttpException.</p>
656 <h3 id="HttpRequest_setOptions">bool HttpRequest::setOptions([array options])</h3>
657 <p>Set the request options to use. See http_get() for a full list of available options.</p>
658 <p>Accepts an array as optional parameters, which values will overwrite the <br />
659 currently set request options. If the parameter is empty or omitted,<br />
660 the options of the HttpRequest object will be reset.</p>
661 <p>Returns TRUE on success, or FALSE on failure.</p>
662 <h3 id="HttpRequest_getOptions">array HttpRequest::getOptions()</h3>
663 <p>Get currently set options.</p>
664 <p>Returns an associative array containing currently set options.</p>
665 <h3 id="HttpRequest_setSslOptions">bool HttpRequest::setSslOptions([array options])</h3>
666 <p>Set SSL options.</p>
667 <p>Accepts an associative array as parameter containing any SSL specific options.<br />
668 If the parameter is empty or omitted, the SSL options will be reset.</p>
669 <p>Returns TRUE on success, or FALSE on failure.</p>
670 <h3 id="HttpRequest_addSslOptions">bool HttpRequest::addSslOptions(array options)</h3>
671 <p>Set additional SSL options.</p>
672 <p>Expects an associative array as parameter containing additional SSL specific options.</p>
673 <p>Returns TRUE on success, or FALSE on failure.</p>
674 <h3 id="HttpRequest_getSslOptions">array HttpRequest::getSslOtpions()</h3>
675 <p>Get previously set SSL options.</p>
676 <p>Returns an associative array containing any previously set SSL options.</p>
677 <h3 id="HttpRequest_addHeaders">bool HttpRequest::addHeaders(array headers)</h3>
678 <p>Add request header name/value pairs.</p>
679 <p>Expects an associative array as parameter containing additional header<br />
680 name/value pairs.</p>
681 <p>Returns TRUE on success, or FALSE on failure.</p>
682 <h3 id="HttpRequest_setHeaders">bool HttpRequest::setHeaders([array headers])</h3>
683 <p>Set request header name/value pairs.</p>
684 <p>Accepts an associative array as parameter containing header name/value pairs.<br />
685 If the parameter is empty or omitted, all previously set headers will be unset.</p>
686 <p>Returns TRUE on success, or FALSE on failure.</p>
687 <h3 id="HttpRequest_getHeaders">array HttpRequest::getHeaders()</h3>
688 <p>Get previously set request headers.</p>
689 <p>Returns an associative array containing all currently set headers.</p>
690 <h3 id="HttpRequest_setCookies">bool HttpRequest::setCookies([array cookies])</h3>
691 <p>Set cookies.</p>
692 <p>Accepts an associative array as parameter containing cookie name/value pairs.<br />
693 If the parameter is empty or omitted, all previously set cookies will be unset.</p>
694 <p>Returns TRUE on success, or FALSE on failure.</p>
695 <h3 id="HttpRequest_addCookies">bool HttpRequest::addCookies(array cookies)</h3>
696 <p>Add cookies.</p>
697 <p>Expects an associative array as parameter containing any cookie name/value<br />
698 pairs to add.</p>
699 <p>Returns TRUE on success, or FALSE on failure.</p>
700 <h3 id="HttpRequest_getCookies">array HttpRequest::getCookies()</h3>
701 <p>Get previously set cookies.</p>
702 <p>Returns an associative array containing any previously set cookies.</p>
703 <h3 id="HttpRequest_setUrl">bool HttpRequest::setUrl(string url)</h3>
704 <p>Set the request URL.</p>
705 <p>Expects a string as parameter specifying the request url.</p>
706 <p>Returns TRUE on success, or FALSE on failure.</p>
707 <h3 id="HttpRequest_getUrl">string HttpRequest::getUrl()</h3>
708 <p>Get the previously set request URL.</p>
709 <p>Returns the currently set request url as string.</p>
710 <h3 id="HttpRequest_setMethod">bool HttpRequest::setMethod(int request_method)</h3>
711 <p>Set the request method.</p>
712 <p>Expects an int as parameter specifying the request method to use.<br />
713 In PHP 5.1+ HttpRequest::METH_*, otherwise the HTTP_METH_* constants can be used.</p>
714 <p>Returns TRUE on success, or FALSE on failure.</p>
715 <h3 id="HttpRequest_getMethod">int HttpRequest::getMethod()</h3>
716 <p>Get the previously set request method.</p>
717 <p>Returns the currently set request method.</p>
718 <h3 id="HttpRequest_setContentType">bool HttpRequest::setContentType(string content_type)</h3>
719 <p>Set the content type the post request should have.</p>
720 <p>Expects a string as parameters containing the content type of the request<br />
721 (primary/secondary).</p>
722 <p>Returns TRUE on success, or FALSE if the content type does not seem to<br />
723 contain a primary and a secondary part.</p>
724 <h3 id="HttpRequest_getContentType">string HttpRequest::getContentType()</h3>
725 <p>Get the previously content type.</p>
726 <p>Returns the previously set content type as string.</p>
727 <h3 id="HttpRequest_setQueryData">bool HttpRequest::setQueryData([mixed query_data])</h3>
728 <p>Set the URL query parameters to use, overwriting previously set query parameters.<br />
729 Affects any request types.</p>
730 <p>Accepts a string or associative array parameter containing the pre-encoded <br />
731 query string or to be encoded query fields. If the parameter is empty or<br />
732 omitted, the query data will be unset. </p>
733 <p>Returns TRUE on success, or FALSE on failure.</p>
734 <h3 id="HttpRequest_getQueryData">string HttpRequest::getQueryData()</h3>
735 <p>Get the current query data in form of an urlencoded query string.</p>
736 <p>Returns a string containing the urlencoded query.</p>
737 <h3 id="HttpRequest_addQueryData">bool HttpRequest::addQueryData(array query_params)</h3>
738 <p>Add parameters to the query parameter list, leaving previously set unchanged.<br />
739 Affects any request type.</p>
740 <p>Expects an associative array as parameter containing the query fields to add.</p>
741 <p>Returns TRUE on success, or FALSE on failure.</p>
742 <h3 id="HttpRequest_addPostFields">bool HttpRequest::addPostFields(array post_data)</h3>
743 <p>Adds POST data entries, leaving previously set unchanged, unless a<br />
744 post entry with the same name already exists. <br />
745 Affects only POST and custom requests.</p>
746 <p>Expects an associative array as parameter containing the post fields.</p>
747 <p>Returns TRUE on success, or FALSE on failure.</p>
748 <h3 id="HttpRequest_setPostFields">bool HttpRequest::setPostFields([array post_data])</h3>
749 <p>Set the POST data entries, overwriting previously set POST data.<br />
750 Affects only POST and custom requests.</p>
751 <p>Accepts an associative array as parameter containing the post fields.<br />
752 If the parameter is empty or omitted, the post data will be unset.</p>
753 <p>Returns TRUE on success, or FALSE on failure.</p>
754 <h3 id="HttpRequest_getPostFields">array HttpRequest::getPostFields()</h3>
755 <p>Get previously set POST data.</p>
756 <p>Returns the currently set post fields as associative array.</p>
757 <h3 id="HttpRequest_setRawPostData">bool HttpRequest::setRawPostData([string raw_post_data])</h3>
758 <p>Set raw post data to send, overwriting previously set raw post data. Don't <br />
759 forget to specify a content type. Affects only POST and custom requests.<br />
760 Only either post fields or raw post data can be used for each request.<br />
761 Raw post data has higher precedence and will be used even if post fields<br />
762 are set. </p>
763 <p>Accepts a string as parameter containing the *raw* post data.</p>
764 <p>Returns TRUE on success, or FALSE on failure.</p>
765 <h3 id="HttpRequest_addRawPostData">bool HttpRequest::addRawPostData(string raw_post_data)</h3>
766 <p>Add raw post data, leaving previously set raw post data unchanged.<br />
767 Affects only POST and custom requests.</p>
768 <p>Expects a string as parameter containing the raw post data to concatenate.</p>
769 <p>Returns TRUE on success, or FALSE on failure.</p>
770 <h3 id="HttpRequest_getRawPostData">string HttpRequest::getRawPostData()</h3>
771 <p>Get previously set raw post data.</p>
772 <p>Returns a string containing the currently set raw post data.</p>
773 <h3 id="HttpRequest_addPostFile">bool HttpRequest::addPostFile(string name, string file[, string content_type = "application/x-octetstream"])</h3>
774 <p>Add a file to the POST request, leaving previously set files unchanged.<br />
775 Affects only POST and custom requests. Cannot be used with raw post data.</p>
776 <p>Expects a string parameter containing the form element name, and a string<br />
777 paremeter containing the path to the file which should be uploaded.<br />
778 Additionally accepts an optional string parameter which should contain<br />
779 the content type of the file.</p>
780 <p>Returns TRUE on success, or FALSE if the content type seems not to contain a <br />
781 primary and a secondary content type part.</p>
782 <h3 id="HttpRequest_setPostFiles">bool HttpRequest::setPostFiles([array post_files])</h3>
783 <p>Set files to post, overwriting previously set post files.<br />
784 Affects only POST and requests. Cannot be used with raw post data.</p>
785 <p>Accepts an array containing the files to post. Each entry should be an<br />
786 associative array with "name", "file" and "type" keys. If the parameter<br />
787 is empty or omitted the post files will be unset.</p>
788 <p>Returns TRUE on success, or FALSE on failure.</p>
789 <h3 id="HttpRequest_getPostFiles">array HttpRequest::getPostFiles()</h3>
790 <p>Get all previously added POST files.</p>
791 <p>Returns an array containing currently set post files.</p>
792 <h3 id="HttpRequest_setPutFile">bool HttpRequest::setPutFile([string file])</h3>
793 <p>Set file to put. Affects only PUT requests.</p>
794 <p>Accepts a string as parameter referencing the path to file.<br />
795 If the parameter is empty or omitted the put file will be unset.</p>
796 <p>Returns TRUE on success, or FALSE on failure.</p>
797 <h3 id="HttpRequest_getPutFile">string HttpRequest::getPutFile()</h3>
798 <p>Get previously set put file.</p>
799 <p>Returns a string containing the path to the currently set put file.</p>
800 <h3 id="HttpRequest_setPutData">bool HttpRequest::setPutData([string put_data])</h3>
801 <p>Set PUT data to send, overwriting previously set PUT data.<br />
802 Affects only PUT requests.<br />
803 Only either PUT data or PUT file can be used for each request.<br />
804 PUT data has higher precedence and will be used even if a PUT<br />
805 file is set. </p>
806 <p>Accepts a string as parameter containing the data to upload.</p>
807 <p>Returns TRUE on success, or FALSE on failure.</p>
808 <h3 id="HttpRequest_addPutData">bool HttpRequest::addPutData(string put_data)</h3>
809 <p>Add PUT data, leaving previously set PUT data unchanged.<br />
810 Affects only PUT requests.</p>
811 <p>Expects a string as parameter containing the data to concatenate.</p>
812 <p>Returns TRUE on success, or FALSE on failure.</p>
813 <h3 id="HttpRequest_getPutData">string HttpRequest::getPutData()</h3>
814 <p>Get previously set PUT data.</p>
815 <p>Returns a string containing the currently set raw post data.</p>
816 <h3 id="HttpRequest_getResponseData">array HttpRequest::getResponseData()</h3>
817 <p>Get all response data after the request has been sent.</p>
818 <p>Returns an associative array with the key "headers" containing an associative<br />
819 array holding all response headers, as well as the key "body" containing a<br />
820 string with the response body. </p>
821 <p>If redirects were allowed and several responses were received, the data <br />
822 references the last received response.</p>
823 <h3 id="HttpRequest_getResponseHeader">mixed HttpRequest::getResponseHeader([string name])</h3>
824 <p>Get response header(s) after the request has been sent.</p>
825 <p>Accepts an string as optional parameter specifying a certain header to read.<br />
826 If the parameter is empty or omitted all response headers will be returned.</p>
827 <p>Returns either a string with the value of the header matching name if requested, <br />
828 FALSE on failure, or an associative array containing all response headers.</p>
829 <p>If redirects were allowed and several responses were received, the data <br />
830 references the last received response.</p>
831 <h3 id="HttpRequest_getResponseCookies">array HttpRequest::getResponseCookies([int flags[, array allowed_extras]])</h3>
832 <p>Get response cookie(s) after the request has been sent.</p>
833 <p>Returns an array of stdClass objects like http_parse_cookie would return.</p>
834 <p>If redirects were allowed and several responses were received, the data <br />
835 references the last received response.</p>
836 <h3 id="HttpRequest_getResponseBody">string HttpRequest::getResponseBody()</h3>
837 <p>Get the response body after the request has been sent.</p>
838 <p>Returns a string containing the response body.</p>
839 <p>If redirects were allowed and several responses were received, the data <br />
840 references the last received response.</p>
841 <h3 id="HttpRequest_getResponseCode">int HttpRequest::getResponseCode()</h3>
842 <p>Get the response code after the request has been sent.</p>
843 <p>Returns an int representing the response code.</p>
844 <p>If redirects were allowed and several responses were received, the data <br />
845 references the last received response.</p>
846 <h3 id="HttpRequest_getResponseStatus">string HttpRequest::getResponseStatus()</h3>
847 <p>Get the response status (i.e. the string after the response code) after the message has been sent.</p>
848 <p>Returns a string containing the response status text.</p>
849 <h3 id="HttpRequest_getResponseInfo">mixed HttpRequest::getResponseInfo([string name])</h3>
850 <p>Get response info after the request has been sent.<br />
851 See http_get() for a full list of returned info.</p>
852 <p>Accepts a string as optional parameter specifying the info to read.<br />
853 If the parameter is empty or omitted, an associative array containing<br />
854 all available info will be returned.</p>
855 <p>Returns either a scalar containing the value of the info matching name if<br />
856 requested, FALSE on failure, or an associative array containing all<br />
857 available info.</p>
858 <p>If redirects were allowed and several responses were received, the data <br />
859 references the last received response.</p>
860 <h3 id="HttpRequest_getResponseMessage">HttpMessage HttpRequest::getResponseMessage()</h3>
861 <p>Get the full response as HttpMessage object after the request has been sent.</p>
862 <p>Returns an HttpMessage object of the response.</p>
863 <p>If redirects were allowed and several responses were received, the data <br />
864 references the last received response. Use HttpMessage::getParentMessage()<br />
865 to access the data of previously received responses within this request<br />
866 cycle.</p>
867 <p>Throws HttpException, HttpRuntimeException.</p>
868 <h3 id="HttpRequest_getRequestMessage">HttpMessage HttpRequest::getRequestMessage()</h3>
869 <p>Get sent HTTP message.</p>
870 <p>Returns an HttpMessage object representing the sent request.</p>
871 <p>If redirects were allowed and several responses were received, the data <br />
872 references the last received response. Use HttpMessage::getParentMessage()<br />
873 to access the data of previously sent requests within this request<br />
874 cycle.</p>
875 <p>Note that the internal request message is immutable, that means that the<br />
876 request message received through HttpRequest::getRequestMessage() will<br />
877 always look the same for the same request, regardless of any changes you<br />
878 may have made to the returned object.</p>
879 <p>Throws HttpMalformedHeadersException, HttpEncodingException.</p>
880 <h3 id="HttpRequest_getRawRequestMessage">string HttpRequest::getRawRequestMessage()</h3>
881 <p>Get sent HTTP message.</p>
882 <p>Returns an HttpMessage in a form of a string</p>
883 <h3 id="HttpRequest_getRawResponseMessage">string HttpRequest::getRawResponseMessage()</h3>
884 <p>Get the entire HTTP response.</p>
885 <p>Returns the complete web server response, including the headers in a form of a string.</p>
886 <h3 id="HttpRequest_getHistory">HttpMessage HttpRequest::getHistory()</h3>
887 <p>Get all sent requests and received responses as an HttpMessage object.</p>
888 <p>If you want to record history, set the instance variable<br />
889 HttpRequest::$recordHistory to TRUE.</p>
890 <p>Returns an HttpMessage object representing the complete request/response<br />
891 history.</p>
892 <p>The object references the last received response, use HttpMessage::getParentMessage() <br />
893 to access the data of previously sent requests and received responses.</p>
894 <p>Throws HttpRuntimeException.</p>
895 <h3 id="HttpRequest_clearHistory">void HttpRequest::clearHistory()</h3>
896 <p>Clear the history.</p>
897 <h3 id="HttpRequest_send">HttpMessage HttpRequest::send()</h3>
898 <p>Send the HTTP request.</p>
899 <p>Returns the received response as HttpMessage object.</p>
900 <p>NOTE: While an exception may be thrown, the transfer could have succeeded <br />
901 at least partially, so you might want to check the return values of various<br />
902 HttpRequest::getResponse*() methods.</p>
903 <p>Throws HttpRuntimeException, HttpRequestException, <br />
904 HttpMalformedHeaderException, HttpEncodingException.</p>
905 <p>GET example:</p><pre><blockquote><code><span style="color: #000000"><br />
906 <span style="color: #0000BB">&lt;?php<br />$r&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://example.com/feed.rss'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_GET</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setOptions</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'lastmodified'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">filemtime</span><span style="color: #007700">(</span><span style="color: #DD0000">'local.rss'</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addQueryData</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'category'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">));<br />try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #0000BB">200</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'local.rss'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseBody</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;}<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">HttpException&nbsp;$ex</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$ex</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span><br />
907 </span></code></blockquote></p>
908 <p></pre></p>
909 <p>POST example:</p><pre><blockquote><code><span style="color: #000000"><br />
910 <span style="color: #0000BB">&lt;?php<br />$r&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://example.com/form.php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_POST</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setOptions</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'cookies'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'lang'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'de'</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPostFields</span><span style="color: #007700">(array(</span><span style="color: #DD0000">'user'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'mike'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'pass'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'s3c|r3t'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPostFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'image'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'profile.jpg'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'image/jpeg'</span><span style="color: #007700">);<br />try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">getBody</span><span style="color: #007700">();<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">HttpException&nbsp;$ex</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$ex</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span><br />
911 </span></code></blockquote></p>
912 <p></pre></p>
913 <hr noshade>
914 <h1 id="http_requestpool_object.c">http_requestpool_object.c</h1>
915 <h2 id="HttpRequestPool" class="o">HttpRequestPool</h2>
916 <h3 id="HttpRequestPool___construct">void HttpRequestPool::__construct([HttpRequest request[, ...]])</h3>
917 <p>Instantiate a new HttpRequestPool object. An HttpRequestPool is<br />
918 able to send several HttpRequests in parallel.</p>
919 <p>WARNING: Don't attach/detach HttpRequest objects to the HttpRequestPool<br />
920 object while you're using the implemented Iterator interface. </p>
921 <p>Accepts virtual infinite optional parameters each referencing an<br />
922 HttpRequest object.</p>
923 <p>Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).</p>
924 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
925 <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$pool&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequestPool</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.google.com/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_HEAD</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.php.net/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_HEAD</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$pool</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach(</span><span style="color: #0000BB">$pool&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s&nbsp;is&nbsp;%s&nbsp;(%d)\n"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getUrl</span><span style="color: #007700">(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()&nbsp;?&nbsp;</span><span style="color: #DD0000">'alive'&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'not&nbsp;alive'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">HttpException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span><br />
926 </span></code></blockquote></p>
927 <p></pre></p>
928 <h3 id="HttpRequestPool___destruct">void HttpRequestPool::__destruct()</h3>
929 <p>Clean up HttpRequestPool object.</p>
930 <h3 id="HttpRequestPool_reset">void HttpRequestPool::reset()</h3>
931 <p>Detach all attached HttpRequest objects.</p>
932 <h3 id="HttpRequestPool_attach">bool HttpRequestPool::attach(HttpRequest request)</h3>
933 <p>Attach an HttpRequest object to this HttpRequestPool.<br />
934 WARNING: set all options prior attaching!</p>
935 <p>Expects the parameter to be an HttpRequest object not already attached to<br />
936 antother HttpRequestPool object.</p>
937 <p>Returns TRUE on success, or FALSE on failure.</p>
938 <p>Throws HttpInvalidParamException, HttpRequestException, <br />
939 HttpRequestPoolException, HttpEncodingException.</p>
940 <h3 id="HttpRequestPool_detach">bool HttpRequestPool::detach(HttpRequest request)</h3>
941 <p>Detach an HttpRequest object from this HttpRequestPool.</p>
942 <p>Expects the parameter to be an HttpRequest object attached to this<br />
943 HttpRequestPool object.</p>
944 <p>Returns TRUE on success, or FALSE on failure.</p>
945 <p>Throws HttpInvalidParamException, HttpRequestPoolException.</p>
946 <h3 id="HttpRequestPool_send">bool HttpRequestPool::send()</h3>
947 <p>Send all attached HttpRequest objects in parallel.</p>
948 <p>Returns TRUE on success, or FALSE on failure.</p>
949 <p>Throws HttpRequestPoolException (HttpSocketException, HttpRequestException, HttpMalformedHeaderException).</p>
950 <h3 id="HttpRequestPool_socketPerform">protected bool HttpRequestPool::socketPerform()</h3>
951 <p>Returns TRUE until each request has finished its transaction.</p>
952 <p>Usage:</p><pre><blockquote><code><span style="color: #000000"><br />
953 <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">MyPool&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">HttpRequestPool<br /></span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">send</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socketSelect</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpSocketExcpetion</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;final&nbsp;function&nbsp;</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getFinishedRequests</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">detach</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;handle&nbsp;response&nbsp;of&nbsp;finished&nbsp;request<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span><br />
954 </span></code></blockquote></p>
955 <p></pre></p>
956 <h3 id="HttpRequestPool_socketSelect">protected bool HttpRequestPool::socketSelect()</h3>
957 <p>See HttpRequestPool::socketPerform().</p>
958 <p>Returns TRUE on success, or FALSE on failure.</p>
959 <h3 id="HttpRequestPool_valid">bool HttpRequestPool::valid()</h3>
960 <p>Implements Iterator::valid().</p>
961 <h3 id="HttpRequestPool_current">HttpRequest HttpRequestPool::current()</h3>
962 <p>Implements Iterator::current().</p>
963 <h3 id="HttpRequestPool_key">int HttpRequestPool::key()</h3>
964 <p>Implements Iterator::key().</p>
965 <h3 id="HttpRequestPool_next">void HttpRequestPool::next()</h3>
966 <p>Implements Iterator::next().</p>
967 <h3 id="HttpRequestPool_rewind">void HttpRequestPool::rewind()</h3>
968 <p>Implements Iterator::rewind().</p>
969 <h3 id="HttpRequestPool_count">int HttpRequestPool::count()</h3>
970 <p>Implements Countable.</p>
971 <p>Returns the number of attached HttpRequest objects.</p>
972 <h3 id="HttpRequestPool_getAttachedRequests">array HttpRequestPool::getAttachedRequests()</h3>
973 <p>Get attached HttpRequest objects.</p>
974 <p>Returns an array containing all currently attached HttpRequest objects.</p>
975 <h3 id="HttpRequestPool_getFinishedRequests">array HttpRequestPool::getFinishedRequests()</h3>
976 <p>Get attached HttpRequest objects that already have finished their work.</p>
977 <p>Returns an array containing all attached HttpRequest objects that<br />
978 already have finished their work.</p>
979 <hr noshade>
980 <h1 id="http_response_object.c">http_response_object.c</h1>
981 <h2 id="HttpResponse" class="o">HttpResponse</h2>
982 <h3 id="HttpResponse_setHeader">static bool HttpResponse::setHeader(string name, mixed value[, bool replace = true])</h3>
983 <p>Send an HTTP header.</p>
984 <p>Expects a string parameter containing the name of the header and a mixed<br />
985 parameter containing the value of the header, which will be converted to<br />
986 a string. Additionally accepts an optional boolean parameter, which<br />
987 specifies whether an existing header should be replaced. If the second<br />
988 parameter is unset no header with this name will be sent. </p>
989 <p>Returns TRUE on success, or FALSE on failure.</p>
990 <p>Throws HttpHeaderException if http.only_exceptions is TRUE.</p>
991 <h3 id="HttpResponse_getHeader">static mixed HttpResponse::getHeader([string name])</h3>
992 <p>Get header(s) about to be sent.</p>
993 <p>Accepts a string as optional parameter which specifies the name of the<br />
994 header to read. If the parameter is empty or omitted, an associative array<br />
995 with all headers will be returned.</p>
996 <p>NOTE: In Apache2 this only works for PHP-5.1.3 and greater.</p>
997 <p>Returns either a string containing the value of the header matching name,<br />
998 FALSE on failure, or an associative array with all headers.</p>
999 <h3 id="HttpResponse_setCache">static bool HttpResponse::setCache(bool cache)</h3>
1000 <p>Whether it should be attempted to cache the entity.<br />
1001 This will result in necessary caching headers and checks of clients<br />
1002 "If-Modified-Since" and "If-None-Match" headers. If one of those headers<br />
1003 matches a "304 Not Modified" status code will be issued.</p>
1004 <p>NOTE: If you're using sessions, be sure that you set session.cache_limiter<br />
1005 to something more appropriate than "no-cache"!</p>
1006 <p>Expects a boolean as parameter specifying whether caching should be attempted.</p>
1007 <p>Returns TRUE on success, or FALSE on failure.</p>
1008 <h3 id="HttpResponse_getCache">static bool HttpResponse::getCache()</h3>
1009 <p>Get current caching setting.</p>
1010 <p>Returns TRUE if caching should be attempted, else FALSE.</p>
1011 <h3 id="HttpResponse_setGzip">static bool HttpResponse::setGzip(bool gzip)</h3>
1012 <p>Enable on-thy-fly gzipping of the sent entity.</p>
1013 <p>Expects a boolean as parameter indicating if GZip compression should be enabled.</p>
1014 <p>Returns TRUE on success, or FALSE on failure.</p>
1015 <h3 id="HttpResponse_getGzip">static bool HttpResponse::getGzip()</h3>
1016 <p>Get current gzipping setting.</p>
1017 <p>Returns TRUE if GZip compression is enabled, else FALSE.</p>
1018 <h3 id="HttpResponse_setCacheControl">static bool HttpResponse::setCacheControl(string control[, int max_age = 0[, bool must_revalidate = true]])</h3>
1019 <p>Set a custom cache-control header, usually being "private" or "public";<br />
1020 The max_age parameter controls how long the cache entry is valid on the client side.</p>
1021 <p>Expects a string parameter containing the primary cache control setting.<br />
1022 Additionally accepts an int parameter specifying the max-age setting.<br />
1023 Accepts an optional third bool parameter indicating whether the cache<br />
1024 must be revalidated every request.</p>
1025 <p>Returns TRUE on success, or FALSE if control does not match one of<br />
1026 "public" , "private" or "no-cache".</p>
1027 <p>Throws HttpInvalidParamException if http.only_exceptions is TRUE.</p>
1028 <h3 id="HttpResponse_getCacheControl">static string HttpResponse::getCacheControl()</h3>
1029 <p>Get current Cache-Control header setting.</p>
1030 <p>Returns the current cache control setting as a string like sent in a header.</p>
1031 <h3 id="HttpResponse_setContentType">static bool HttpResponse::setContentType(string content_type)</h3>
1032 <p>Set the content-type of the sent entity.</p>
1033 <p>Expects a string as parameter specifying the content type of the sent entity.</p>
1034 <p>Returns TRUE on success, or FALSE if the content type does not seem to<br />
1035 contain a primary and secondary content type part.</p>
1036 <p>Throws HttpInvalidParamException if http.only_exceptions is TRUE.</p>
1037 <h3 id="HttpResponse_getContentType">static string HttpResponse::getContentType()</h3>
1038 <p>Get current Content-Type header setting.</p>
1039 <p>Returns the currently set content type as string.</p>
1040 <h3 id="HttpResponse_guessContentType">static string HttpResponse::guessContentType(string magic_file[, int magic_mode = MAGIC_MIME])</h3>
1041 <p>Attempts to guess the content type of supplied payload through libmagic.<br />
1042 If the attempt is successful, the guessed content type will automatically<br />
1043 be set as response content type. </p>
1044 <p>Expects a string parameter specifying the magic.mime database to use.<br />
1045 Additionally accepts an optional int parameter, being flags for libmagic.</p>
1046 <p>Returns the guessed content type on success, or FALSE on failure.</p>
1047 <p>Throws HttpRuntimeException, HttpInvalidParamException <br />
1048 if http.only_exceptions is TRUE.</p>
1049 <h3 id="HttpResponse_setContentDisposition">static bool HttpResponse::setContentDisposition(string filename[, bool inline = false])</h3>
1050 <p>Set the Content-Disposition. The Content-Disposition header is very useful<br />
1051 if the data actually sent came from a file or something similar, that should<br />
1052 be "saved" by the client/user (i.e. by browsers "Save as..." popup window).</p>
1053 <p>Expects a string parameter specifying the file name the "Save as..." dialog<br />
1054 should display. Optionally accepts a bool parameter, which, if set to true<br />
1055 and the user agent knows how to handle the content type, will probably not<br />
1056 cause the popup window to be shown.</p>
1057 <p>Returns TRUE on success or FALSE on failure.</p>
1058 <h3 id="HttpResponse_getContentDisposition">static string HttpResponse::getContentDisposition()</h3>
1059 <p>Get current Content-Disposition setting.</p>
1060 <p>Returns the current content disposition as string like sent in a header.</p>
1061 <h3 id="HttpResponse_setETag">static bool HttpResponse::setETag(string etag)</h3>
1062 <p>Set a custom ETag. Use this only if you know what you're doing.</p>
1063 <p>Expects an unquoted string as parameter containing the ETag.</p>
1064 <p>Returns TRUE on success, or FALSE on failure.</p>
1065 <h3 id="HttpResponse_getETag">static string HttpResponse::getETag()</h3>
1066 <p>Get calculated or previously set custom ETag.</p>
1067 <p>Returns the calculated or previously set ETag as unquoted string.</p>
1068 <h3 id="HttpResponse_setLastModified">static bool HttpResponse::setLastModified(int timestamp)</h3>
1069 <p>Set a custom Last-Modified date.</p>
1070 <p>Expects an unix timestamp as parameter representing the last modification<br />
1071 time of the sent entity.</p>
1072 <p>Returns TRUE on success, or FALSE on failure.</p>
1073 <h3 id="HttpResponse_getLastModified">static int HttpResponse::getLastModified()</h3>
1074 <p>Get calculated or previously set custom Last-Modified date.</p>
1075 <p>Returns the calculated or previously set unix timestamp.</p>
1076 <h3 id="HttpResponse_setThrottleDelay">static bool HttpResponse::setThrottleDelay(double seconds)</h3>
1077 <p>Sets the throttle delay for use with HttpResponse::setBufferSize().</p>
1078 <p>Provides a basic throttling mechanism, which will yield the current process<br />
1079 resp. thread until the entity has been completely sent, though.</p>
1080 <p>Note: This doesn't really work with the FastCGI SAPI.</p>
1081 <p>Expects a double parameter specifying the seconds too sleep() after<br />
1082 each chunk sent.</p>
1083 <p>Returns TRUE on success, or FALSE on failure.</p>
1084 <h3 id="HttpResponse_getThrottleDelay">static double HttpResponse::getThrottleDelay()</h3>
1085 <p>Get the current throttle delay.</p>
1086 <p>Returns a double representing the throttle delay in seconds.</p>
1087 <h3 id="HttpResponse_setBufferSize">static bool HttpResponse::setBufferSize(int bytes)</h3>
1088 <p>Sets the send buffer size for use with HttpResponse::setThrottleDelay().</p>
1089 <p>Provides a basic throttling mechanism, which will yield the current process<br />
1090 resp. thread until the entity has been completely sent, though.</p>
1091 <p>Note: This doesn't really work with the FastCGI SAPI.</p>
1092 <p>Expects an int parameter representing the chunk size in bytes.</p>
1093 <p>Returns TRUE on success, or FALSE on failure.</p>
1094 <h3 id="HttpResponse_getBufferSize">static int HttpResponse::getBufferSize()</h3>
1095 <p>Get current buffer size.</p>
1096 <p>Returns an int representing the current buffer size in bytes.</p>
1097 <h3 id="HttpResponse_setData">static bool HttpResponse::setData(mixed data)</h3>
1098 <p>Set the data to be sent.</p>
1099 <p>Expects one parameter, which will be converted to a string and contains <br />
1100 the data to send.</p>
1101 <p>Returns TRUE on success, or FALSE on failure.</p>
1102 <h3 id="HttpResponse_getData">static string HttpResponse::getData()</h3>
1103 <p>Get the previously set data to be sent.</p>
1104 <p>Returns a string containing the previously set data to send.</p>
1105 <h3 id="HttpResponse_setStream">static bool HttpResponse::setStream(resource stream)</h3>
1106 <p>Set the resource to be sent.</p>
1107 <p>Expects a resource parameter referencing an already opened stream from<br />
1108 which the data to send will be read.</p>
1109 <p>Returns TRUE on success, or FALSE on failure.</p>
1110 <h3 id="HttpResponse_getStream">static resource HttpResponse::getStream()</h3>
1111 <p>Get the previously set resource to be sent.</p>
1112 <p>Returns the previously set resource.</p>
1113 <h3 id="HttpResponse_setFile">static bool HttpResponse::setFile(string file)</h3>
1114 <p>Set the file to be sent.</p>
1115 <p>Expects a string as parameter, specifying the path to the file to send.</p>
1116 <p>Returns TRUE on success, or FALSE on failure.</p>
1117 <h3 id="HttpResponse_getFile">static string HttpResponse::getFile()</h3>
1118 <p>Get the previously set file to be sent.</p>
1119 <p>Returns the previously set path to the file to send as string.</p>
1120 <h3 id="HttpResponse_send">static bool HttpResponse::send([bool clean_ob = true])</h3>
1121 <p>Finally send the entity.</p>
1122 <p>Accepts an optional boolean parameter, specifying whether the output<br />
1123 buffers should be discarded prior sending. A successful caching attempt<br />
1124 will cause a script termination, and write a log entry if the INI setting<br />
1125 http.cache_log is set.</p>
1126 <p>Returns TRUE on success, or FALSE on failure.</p>
1127 <p>Throws HttpHeaderException, HttpResponseException if http.only_exceptions is TRUE.</p>
1128 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
1129 <span style="color: #0000BB">&lt;?php<br />HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">setCache</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">setContentType</span><span style="color: #007700">(</span><span style="color: #DD0000">'application/pdf'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">setContentDisposition</span><span style="color: #007700">(</span><span style="color: #DD0000">"$user.pdf"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">setFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'sheet.pdf'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">send</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span><br />
1130 </span></code></blockquote></p>
1131 <p></pre></p>
1132 <h3 id="HttpResponse_capture">static void HttpResponse::capture()</h3>
1133 <p>Capture script output.</p>
1134 <p>Example:</p><pre><blockquote><code><span style="color: #000000"><br />
1135 <span style="color: #0000BB">&lt;?php<br />HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">setCache</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">HttpResponse</span><span style="color: #007700">::</span><span style="color: #0000BB">capture</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">//&nbsp;script&nbsp;follows<br /></span><span style="color: #0000BB">?&gt;</span><br />
1136 </span></code></blockquote></p>
1137 <p></pre></p>
1138 <hr noshade>
1139 <div class="toc"><strong>Table of Contents</strong>
1140 <ul>
1141 <li><a class="tocfile" href="#http_functions.c">http_functions.c</a>
1142 <ul>
1143 <li><a href="#http_date">http_date</a>
1144 </li>
1145 <li><a href="#http_build_url">http_build_url</a>
1146 </li>
1147 <li><a href="#http_build_str">http_build_str</a>
1148 </li>
1149 <li><a href="#http_negotiate_language">http_negotiate_language</a>
1150 </li>
1151 <li><a href="#http_negotiate_charset">http_negotiate_charset</a>
1152 </li>
1153 <li><a href="#http_negotiate_content_type">http_negotiate_content_type</a>
1154 </li>
1155 <li><a href="#http_send_status">http_send_status</a>
1156 </li>
1157 <li><a href="#http_send_last_modified">http_send_last_modified</a>
1158 </li>
1159 <li><a href="#http_send_content_type">http_send_content_type</a>
1160 </li>
1161 <li><a href="#http_send_content_disposition">http_send_content_disposition</a>
1162 </li>
1163 <li><a href="#http_match_modified">http_match_modified</a>
1164 </li>
1165 <li><a href="#http_match_etag">http_match_etag</a>
1166 </li>
1167 <li><a href="#http_cache_last_modified">http_cache_last_modified</a>
1168 </li>
1169 <li><a href="#http_cache_etag">http_cache_etag</a>
1170 </li>
1171 <li><a href="#ob_etaghandler">ob_etaghandler</a>
1172 </li>
1173 <li><a href="#http_throttle">http_throttle</a>
1174 </li>
1175 <li><a href="#http_redirect">http_redirect</a>
1176 </li>
1177 <li><a href="#http_send_data">http_send_data</a>
1178 </li>
1179 <li><a href="#http_send_file">http_send_file</a>
1180 </li>
1181 <li><a href="#http_send_stream">http_send_stream</a>
1182 </li>
1183 <li><a href="#http_chunked_decode">http_chunked_decode</a>
1184 </li>
1185 <li><a href="#http_parse_message">http_parse_message</a>
1186 </li>
1187 <li><a href="#http_parse_headers">http_parse_headers</a>
1188 </li>
1189 <li><a href="#http_parse_cookie">http_parse_cookie</a>
1190 </li>
1191 <li><a href="#http_get_request_headers">http_get_request_headers</a>
1192 </li>
1193 <li><a href="#http_get_request_body">http_get_request_body</a>
1194 </li>
1195 <li><a href="#http_get_request_body_stream">http_get_request_body_stream</a>
1196 </li>
1197 <li><a href="#http_match_request_header">http_match_request_header</a>
1198 </li>
1199 <li><a href="#http_get">http_get</a>
1200 </li>
1201 <li><a href="#http_head">http_head</a>
1202 </li>
1203 <li><a href="#http_post_data">http_post_data</a>
1204 </li>
1205 <li><a href="#http_post_fields">http_post_fields</a>
1206 </li>
1207 <li><a href="#http_put_file">http_put_file</a>
1208 </li>
1209 <li><a href="#http_put_stream">http_put_stream</a>
1210 </li>
1211 <li><a href="#http_put_data">http_put_data</a>
1212 </li>
1213 <li><a href="#http_request">http_request</a>
1214 </li>
1215 <li><a href="#http_request_body_encode">http_request_body_encode</a>
1216 </li>
1217 <li><a href="#http_request_method_register">http_request_method_register</a>
1218 </li>
1219 <li><a href="#http_request_method_unregister">http_request_method_unregister</a>
1220 </li>
1221 <li><a href="#http_request_method_exists">http_request_method_exists</a>
1222 </li>
1223 <li><a href="#http_request_method_name">http_request_method_name</a>
1224 </li>
1225 <li><a href="#http_deflate">http_deflate</a>
1226 </li>
1227 <li><a href="#http_inflate">http_inflate</a>
1228 </li>
1229 <li><a href="#ob_deflatehandler">ob_deflatehandler</a>
1230 </li>
1231 <li><a href="#ob_inflatehandler">ob_inflatehandler</a>
1232 </li>
1233 <li><a href="#http_support">http_support</a>
1234 </li>
1235 </ul>
1236 </li>
1237 <li><a class="tocfile" href="#http_deflatestream_object.c">http_deflatestream_object.c</a>
1238 <ul>
1239 <li><a href="#HttpDeflateStream___construct">HttpDeflateStream::__construct()</a></li>
1240 <li><a href="#HttpDeflateStream_update">HttpDeflateStream::update()</a></li>
1241 <li><a href="#HttpDeflateStream_flush">HttpDeflateStream::flush()</a></li>
1242 <li><a href="#HttpDeflateStream_finish">HttpDeflateStream::finish()</a></li>
1243 </li>
1244 </ul>
1245 </li>
1246 <li><a class="tocfile" href="#http_inflatestream_object.c">http_inflatestream_object.c</a>
1247 <ul>
1248 <li><a href="#HttpInflateStream_update">HttpInflateStream::update()</a></li>
1249 <li><a href="#HttpInflateStream_flush">HttpInflateStream::flush()</a></li>
1250 <li><a href="#HttpInflateStream_finish">HttpInflateStream::finish()</a></li>
1251 </li>
1252 </ul>
1253 </li>
1254 <li><a class="tocfile" href="#http_message_object.c">http_message_object.c</a>
1255 <ul>
1256 <li><a href="#HttpMessage___construct">HttpMessage::__construct()</a></li>
1257 <li><a href="#HttpMessage_fromString">HttpMessage::fromString()</a></li>
1258 <li><a href="#HttpMessage_getBody">HttpMessage::getBody()</a></li>
1259 <li><a href="#HttpMessage_setBody">HttpMessage::setBody()</a></li>
1260 <li><a href="#HttpMessage_getHeaders">HttpMessage::getHeaders()</a></li>
1261 <li><a href="#HttpMessage_setHeaders">HttpMessage::setHeaders()</a></li>
1262 <li><a href="#HttpMessage_addHeaders">HttpMessage::addHeaders()</a></li>
1263 <li><a href="#HttpMessage_getType">HttpMessage::getType()</a></li>
1264 <li><a href="#HttpMessage_setType">HttpMessage::setType()</a></li>
1265 <li><a href="#HttpMessage_getResponseCode">HttpMessage::getResponseCode()</a></li>
1266 <li><a href="#HttpMessage_setResponseCode">HttpMessage::setResponseCode()</a></li>
1267 <li><a href="#HttpMessage_getResponseStatus">HttpMessage::getResponseStatus()</a></li>
1268 <li><a href="#HttpMessage_setResponseStatus">HttpMessage::setResponseStatus()</a></li>
1269 <li><a href="#HttpMessage_getRequestMethod">HttpMessage::getRequestMethod()</a></li>
1270 <li><a href="#HttpMessage_setRequestMethod">HttpMessage::setRequestMethod()</a></li>
1271 <li><a href="#HttpMessage_getRequestUrl">HttpMessage::getRequestUrl()</a></li>
1272 <li><a href="#HttpMessage_setRequestUrl">HttpMessage::setRequestUrl()</a></li>
1273 <li><a href="#HttpMessage_getHttpVersion">HttpMessage::getHttpVersion()</a></li>
1274 <li><a href="#HttpMessage_setHttpVersion">HttpMessage::setHttpVersion()</a></li>
1275 <li><a href="#HttpMessage_getParentMessage">HttpMessage::getParentMessage()</a></li>
1276 <li><a href="#HttpMessage_send">HttpMessage::send()</a></li>
1277 <li><a href="#HttpMessage_toString">HttpMessage::toString()</a></li>
1278 <li><a href="#HttpMessage_toMessageTypeObject">HttpMessage::toMessageTypeObject()</a></li>
1279 <li><a href="#HttpMessage_count">HttpMessage::count()</a></li>
1280 <li><a href="#HttpMessage_serialize">HttpMessage::serialize()</a></li>
1281 <li><a href="#HttpMessage_unserialize">HttpMessage::unserialize()</a></li>
1282 <li><a href="#HttpMessage_detach">HttpMessage::detach()</a></li>
1283 <li><a href="#HttpMessage_prepend">HttpMessage::prepend()</a></li>
1284 <li><a href="#HttpMessage_reverse">HttpMessage::reverse()</a></li>
1285 <li><a href="#HttpMessage_rewind">HttpMessage::rewind()</a></li>
1286 <li><a href="#HttpMessage_valid">HttpMessage::valid()</a></li>
1287 <li><a href="#HttpMessage_next">HttpMessage::next()</a></li>
1288 <li><a href="#HttpMessage_key">HttpMessage::key()</a></li>
1289 <li><a href="#HttpMessage_current">HttpMessage::current()</a></li>
1290 </li>
1291 </ul>
1292 </li>
1293 <li><a class="tocfile" href="#http_querystring_object.c">http_querystring_object.c</a>
1294 <ul>
1295 <li><a href="#HttpQueryString___construct">HttpQueryString::__construct()</a></li>
1296 <li><a href="#HttpQueryString_toString">HttpQueryString::toString()</a></li>
1297 <li><a href="#HttpQueryString_toArray">HttpQueryString::toArray()</a></li>
1298 <li><a href="#HttpQueryString_get">HttpQueryString::get()</a></li>
1299 <li><a href="#HttpQueryString_set">HttpQueryString::set()</a></li>
1300 <li><a href="#HttpQueryString_singleton">HttpQueryString::singleton()</a></li>
1301 <li><a href="#HttpQueryString_xlate">HttpQueryString::xlate()</a></li>
1302 <li><a href="#HttpQueryString_serialize">HttpQueryString::serialize()</a></li>
1303 <li><a href="#HttpQueryString_unserialize">HttpQueryString::unserialize()</a></li>
1304 </li>
1305 </ul>
1306 </li>
1307 <li><a class="tocfile" href="#http_request_object.c">http_request_object.c</a>
1308 <ul>
1309 <li><a href="#HttpRequest___construct">HttpRequest::__construct()</a></li>
1310 <li><a href="#HttpRequest_setOptions">HttpRequest::setOptions()</a></li>
1311 <li><a href="#HttpRequest_getOptions">HttpRequest::getOptions()</a></li>
1312 <li><a href="#HttpRequest_setSslOptions">HttpRequest::setSslOptions()</a></li>
1313 <li><a href="#HttpRequest_addSslOptions">HttpRequest::addSslOptions()</a></li>
1314 <li><a href="#HttpRequest_getSslOptions">HttpRequest::getSslOptions()</a></li>
1315 <li><a href="#HttpRequest_addHeaders">HttpRequest::addHeaders()</a></li>
1316 <li><a href="#HttpRequest_setHeaders">HttpRequest::setHeaders()</a></li>
1317 <li><a href="#HttpRequest_getHeaders">HttpRequest::getHeaders()</a></li>
1318 <li><a href="#HttpRequest_setCookies">HttpRequest::setCookies()</a></li>
1319 <li><a href="#HttpRequest_addCookies">HttpRequest::addCookies()</a></li>
1320 <li><a href="#HttpRequest_getCookies">HttpRequest::getCookies()</a></li>
1321 <li><a href="#HttpRequest_setUrl">HttpRequest::setUrl()</a></li>
1322 <li><a href="#HttpRequest_getUrl">HttpRequest::getUrl()</a></li>
1323 <li><a href="#HttpRequest_setMethod">HttpRequest::setMethod()</a></li>
1324 <li><a href="#HttpRequest_getMethod">HttpRequest::getMethod()</a></li>
1325 <li><a href="#HttpRequest_setContentType">HttpRequest::setContentType()</a></li>
1326 <li><a href="#HttpRequest_getContentType">HttpRequest::getContentType()</a></li>
1327 <li><a href="#HttpRequest_setQueryData">HttpRequest::setQueryData()</a></li>
1328 <li><a href="#HttpRequest_getQueryData">HttpRequest::getQueryData()</a></li>
1329 <li><a href="#HttpRequest_addQueryData">HttpRequest::addQueryData()</a></li>
1330 <li><a href="#HttpRequest_addPostFields">HttpRequest::addPostFields()</a></li>
1331 <li><a href="#HttpRequest_setPostFields">HttpRequest::setPostFields()</a></li>
1332 <li><a href="#HttpRequest_getPostFields">HttpRequest::getPostFields()</a></li>
1333 <li><a href="#HttpRequest_setRawPostData">HttpRequest::setRawPostData()</a></li>
1334 <li><a href="#HttpRequest_addRawPostData">HttpRequest::addRawPostData()</a></li>
1335 <li><a href="#HttpRequest_getRawPostData">HttpRequest::getRawPostData()</a></li>
1336 <li><a href="#HttpRequest_addPostFile">HttpRequest::addPostFile()</a></li>
1337 <li><a href="#HttpRequest_setPostFiles">HttpRequest::setPostFiles()</a></li>
1338 <li><a href="#HttpRequest_getPostFiles">HttpRequest::getPostFiles()</a></li>
1339 <li><a href="#HttpRequest_setPutFile">HttpRequest::setPutFile()</a></li>
1340 <li><a href="#HttpRequest_getPutFile">HttpRequest::getPutFile()</a></li>
1341 <li><a href="#HttpRequest_setPutData">HttpRequest::setPutData()</a></li>
1342 <li><a href="#HttpRequest_addPutData">HttpRequest::addPutData()</a></li>
1343 <li><a href="#HttpRequest_getPutData">HttpRequest::getPutData()</a></li>
1344 <li><a href="#HttpRequest_getResponseData">HttpRequest::getResponseData()</a></li>
1345 <li><a href="#HttpRequest_getResponseHeader">HttpRequest::getResponseHeader()</a></li>
1346 <li><a href="#HttpRequest_getResponseCookies">HttpRequest::getResponseCookies()</a></li>
1347 <li><a href="#HttpRequest_getResponseBody">HttpRequest::getResponseBody()</a></li>
1348 <li><a href="#HttpRequest_getResponseCode">HttpRequest::getResponseCode()</a></li>
1349 <li><a href="#HttpRequest_getResponseStatus">HttpRequest::getResponseStatus()</a></li>
1350 <li><a href="#HttpRequest_getResponseInfo">HttpRequest::getResponseInfo()</a></li>
1351 <li><a href="#HttpRequest_getResponseMessage">HttpRequest::getResponseMessage()</a></li>
1352 <li><a href="#HttpRequest_getRequestMessage">HttpRequest::getRequestMessage()</a></li>
1353 <li><a href="#HttpRequest_getRawRequestMessage">HttpRequest::getRawRequestMessage()</a></li>
1354 <li><a href="#HttpRequest_getRawResponseMessage">HttpRequest::getRawResponseMessage()</a></li>
1355 <li><a href="#HttpRequest_getHistory">HttpRequest::getHistory()</a></li>
1356 <li><a href="#HttpRequest_clearHistory">HttpRequest::clearHistory()</a></li>
1357 <li><a href="#HttpRequest_send">HttpRequest::send()</a></li>
1358 </li>
1359 </ul>
1360 </li>
1361 <li><a class="tocfile" href="#http_requestpool_object.c">http_requestpool_object.c</a>
1362 <ul>
1363 <li><a href="#HttpRequestPool___construct">HttpRequestPool::__construct()</a></li>
1364 <li><a href="#HttpRequestPool___destruct">HttpRequestPool::__destruct()</a></li>
1365 <li><a href="#HttpRequestPool_reset">HttpRequestPool::reset()</a></li>
1366 <li><a href="#HttpRequestPool_attach">HttpRequestPool::attach()</a></li>
1367 <li><a href="#HttpRequestPool_detach">HttpRequestPool::detach()</a></li>
1368 <li><a href="#HttpRequestPool_send">HttpRequestPool::send()</a></li>
1369 <li><a href="#HttpRequestPool_socketPerform">HttpRequestPool::socketPerform()</a></li>
1370 <li><a href="#HttpRequestPool_socketSelect">HttpRequestPool::socketSelect()</a></li>
1371 <li><a href="#HttpRequestPool_valid">HttpRequestPool::valid()</a></li>
1372 <li><a href="#HttpRequestPool_current">HttpRequestPool::current()</a></li>
1373 <li><a href="#HttpRequestPool_key">HttpRequestPool::key()</a></li>
1374 <li><a href="#HttpRequestPool_next">HttpRequestPool::next()</a></li>
1375 <li><a href="#HttpRequestPool_rewind">HttpRequestPool::rewind()</a></li>
1376 <li><a href="#HttpRequestPool_count">HttpRequestPool::count()</a></li>
1377 <li><a href="#HttpRequestPool_getAttachedRequests">HttpRequestPool::getAttachedRequests()</a></li>
1378 <li><a href="#HttpRequestPool_getFinishedRequests">HttpRequestPool::getFinishedRequests()</a></li>
1379 </li>
1380 </ul>
1381 </li>
1382 <li><a class="tocfile" href="#http_response_object.c">http_response_object.c</a>
1383 <ul>
1384 <li><a href="#HttpResponse_setHeader">HttpResponse::setHeader()</a></li>
1385 <li><a href="#HttpResponse_getHeader">HttpResponse::getHeader()</a></li>
1386 <li><a href="#HttpResponse_setCache">HttpResponse::setCache()</a></li>
1387 <li><a href="#HttpResponse_getCache">HttpResponse::getCache()</a></li>
1388 <li><a href="#HttpResponse_setGzip">HttpResponse::setGzip()</a></li>
1389 <li><a href="#HttpResponse_getGzip">HttpResponse::getGzip()</a></li>
1390 <li><a href="#HttpResponse_setCacheControl">HttpResponse::setCacheControl()</a></li>
1391 <li><a href="#HttpResponse_getCacheControl">HttpResponse::getCacheControl()</a></li>
1392 <li><a href="#HttpResponse_setContentType">HttpResponse::setContentType()</a></li>
1393 <li><a href="#HttpResponse_getContentType">HttpResponse::getContentType()</a></li>
1394 <li><a href="#HttpResponse_guessContentType">HttpResponse::guessContentType()</a></li>
1395 <li><a href="#HttpResponse_setContentDisposition">HttpResponse::setContentDisposition()</a></li>
1396 <li><a href="#HttpResponse_getContentDisposition">HttpResponse::getContentDisposition()</a></li>
1397 <li><a href="#HttpResponse_setETag">HttpResponse::setETag()</a></li>
1398 <li><a href="#HttpResponse_getETag">HttpResponse::getETag()</a></li>
1399 <li><a href="#HttpResponse_setLastModified">HttpResponse::setLastModified()</a></li>
1400 <li><a href="#HttpResponse_getLastModified">HttpResponse::getLastModified()</a></li>
1401 <li><a href="#HttpResponse_setThrottleDelay">HttpResponse::setThrottleDelay()</a></li>
1402 <li><a href="#HttpResponse_getThrottleDelay">HttpResponse::getThrottleDelay()</a></li>
1403 <li><a href="#HttpResponse_setBufferSize">HttpResponse::setBufferSize()</a></li>
1404 <li><a href="#HttpResponse_getBufferSize">HttpResponse::getBufferSize()</a></li>
1405 <li><a href="#HttpResponse_setData">HttpResponse::setData()</a></li>
1406 <li><a href="#HttpResponse_getData">HttpResponse::getData()</a></li>
1407 <li><a href="#HttpResponse_setStream">HttpResponse::setStream()</a></li>
1408 <li><a href="#HttpResponse_getStream">HttpResponse::getStream()</a></li>
1409 <li><a href="#HttpResponse_setFile">HttpResponse::setFile()</a></li>
1410 <li><a href="#HttpResponse_getFile">HttpResponse::getFile()</a></li>
1411 <li><a href="#HttpResponse_send">HttpResponse::send()</a></li>
1412 <li><a href="#HttpResponse_capture">HttpResponse::capture()</a></li>
1413 </li>
1414 </ul>
1415 </li>
1416 </ul>
1417 </div>
1418 <p><b>Generated at: Thu, 13 Apr 2006 17:25:58 +0200</b></p>
1419 </body>
1420 </html>
1421