2 <head><title>Function Summary
</title>
3 <style>body { font-size:
80%; font-family: sans-serif; } h2 { color: #
339; } pre { font-size:
1.2em; } pre br { display: none; } pre code br { display: block; }
</style></head>
6 <h2 id=
"http_date">string http_date([int timestamp])
</h2>
7 <p>This function returns a valid HTTP date regarding RFC
822/
1123<br />
8 looking like:
"Wed, 22 Dec 2004 11:34:47 GMT"</p>
9 <h2 id=
"http_absolute_uri">string http_absolute_uri(string url[, string proto])
</h2>
10 <p>This function returns an absolute URI constructed from url.
<br />
11 If the url is already abolute but a different proto was supplied,
<br />
12 only the proto part of the URI will be updated. If url has no
<br />
13 path specified, the path of the current REQUEST_URI will be taken.
<br />
14 The host will be taken either from the Host HTTP header of the client
<br />
15 the SERVER_NAME or just localhost if prior are not available.
</p><p>Some examples:
<br />
17 url =
"page.php" =
> http://www.example.com/current/path/page.php
<br />
18 url =
"/page.php" =
> http://www.example.com/page.php
<br />
19 url =
"/page.php", proto =
"https" =
> https://www.example.com/page.php
<br />
21 <h2 id=
"http_negotiate_language">string http_negotiate_language(array supported[, string default = 'en-US'])
</h2>
22 <p>This function negotiates the clients preferred language based on its
<br />
23 Accept-Language HTTP header. It returns the negotiated language or
<br />
24 the default language if none match.
</p><p>The qualifier is recognized and languages without qualifier are rated highest.
</p><p>The supported parameter is expected to be an array having
<br />
25 the supported languages as array values.
</p><p>Example:
<br />
27 <code><font color=
"#000000"><br />
28 <font color=
"#0000BB"><?php
<br />$langs
</font><font color=
"#007700">= array(
<br /> </font><font color=
"#DD0000">'en-US'
</font><font color=
"#007700">,
</font><font color=
"#FF8000">// default
<br /> </font><font color=
"#DD0000">'fr'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'fr-FR'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'de'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'de-DE'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'de-AT'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'de-CH'
</font><font color=
"#007700">,
<br />);
<br />include
</font><font color=
"#DD0000">'./langs/'
</font><font color=
"#007700">.
</font><font color=
"#0000BB">http_negotiate_language
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$langs
</font><font color=
"#007700">) .
</font><font color=
"#DD0000">'.php'
</font><font color=
"#007700">;
<br /></font><font color=
"#0000BB">?
></font><br />
32 <h2 id=
"http_negotiate_charset">string http_negotiate_charset(array supported[, string default = 'iso-
8859-
1'])
</h2>
33 <p>This function negotiates the clients preferred charset based on its
<br />
34 Accept-Charset HTTP header. It returns the negotiated charset or
<br />
35 the default charset if none match.
</p><p>The qualifier is recognized and charset without qualifier are rated highest.
</p><p>The supported parameter is expected to be an array having
<br />
36 the supported charsets as array values.
</p><p>Example:
<br />
38 <code><font color=
"#000000"><br />
39 <font color=
"#0000BB"><?php
<br />$charsets
</font><font color=
"#007700">= array(
<br /> </font><font color=
"#DD0000">'iso-
8859-
1'
</font><font color=
"#007700">,
</font><font color=
"#FF8000">// default
<br /> </font><font color=
"#DD0000">'iso-
8859-
2'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'iso-
8859-
15'
</font><font color=
"#007700">,
<br /> </font><font color=
"#DD0000">'utf-
8'
<br /></font><font color=
"#007700">);
<br /></font><font color=
"#0000BB">$pref
</font><font color=
"#007700">=
</font><font color=
"#0000BB">http_negotiate_charset
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$charsets
</font><font color=
"#007700">);
<br />if (!
</font><font color=
"#0000BB">strcmp
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$pref
</font><font color=
"#007700">,
</font><font color=
"#DD0000">'iso-
8859-
1'
</font><font color=
"#007700">)) {
<br /> </font><font color=
"#0000BB">iconv_set_encoding
</font><font color=
"#007700">(
</font><font color=
"#DD0000">'internal_encoding'
</font><font color=
"#007700">,
</font><font color=
"#DD0000">'iso-
8859-
1'
</font><font color=
"#007700">);
<br /> </font><font color=
"#0000BB">iconv_set_encoding
</font><font color=
"#007700">(
</font><font color=
"#DD0000">'output_encoding'
</font><font color=
"#007700">,
</font><font color=
"#0000BB">$pref
</font><font color=
"#007700">);
<br /> </font><font color=
"#0000BB">ob_start
</font><font color=
"#007700">(
</font><font color=
"#DD0000">'ob_iconv_handler'
</font><font color=
"#007700">);
<br />}
<br /></font><font color=
"#0000BB">?
></font><br />
43 <h2 id=
"http_send_status">bool http_send_status(int status)
</h2>
44 <p>Send HTTP status code.
</p>
45 <h2 id=
"http_send_last_modified">bool http_send_last_modified([int timestamp])
</h2>
46 <p>This converts the given timestamp to a valid HTTP date and
<br />
47 sends it as
"Last-Modified" HTTP header. If timestamp is
<br />
48 omitted, current time is sent.
</p>
49 <h2 id=
"http_match_modified">bool http_match_modified([int timestamp])
</h2>
50 <p>Matches the given timestamp against the clients
"If-Modified-Since" resp.
<br />
51 "If-Unmodified-Since" HTTP headers.
</p>
52 <h2 id=
"http_match_etag">bool http_match_etag(string etag)
</h2>
53 <p>This matches the given ETag against the clients
<br />
54 "If-Match" resp.
"If-None-Match" HTTP headers.
</p>
55 <h2 id=
"http_cache_last_modified">bool http_cache_last_modified([int timestamp_or_expires]])
</h2>
56 <p>If timestamp_or_exires is greater than
0, it is handled as timestamp
<br />
57 and will be sent as date of last modification. If it is
0 or omitted,
<br />
58 the current time will be sent as Last-Modified date. If it's negative,
<br />
59 it is handled as expiration time in seconds, which means that if the
<br />
60 requested last modification date is not between the calculated timespan,
<br />
61 the Last-Modified header is updated and the actual body will be sent.
</p>
62 <h2 id=
"http_cache_etag">bool http_cache_etag([string etag])
</h2>
63 <p>This function attempts to cache the HTTP body based on an ETag,
<br />
64 either supplied or generated through calculation of the MD5
<br />
65 checksum of the output (uses output buffering).
</p><p>If clients
"If-None-Match" header matches the supplied/calculated
<br />
66 ETag, the body is considered cached on the clients side and
<br />
67 a
"304 Not Modified" status code is issued.
</p>
68 <h2 id=
"http_redirect">void http_redirect([string url[, array params[, bool session,[ bool permanent]]]])
</h2>
69 <p>Redirect to a given url.
<br />
70 The supplied url will be expanded with http_absolute_uri(), the params array will
<br />
71 be treated with http_build_query() and the session identification will be appended
<br />
72 if session is true.
</p><p>Depending on permanent the redirection will be issued with a permanent
<br />
73 (
"301 Moved Permanently") or a temporary (
"302 Found") redirection
<br />
74 status code.
</p><p>To be RFC compliant,
"Redirecting to <a>URI</a>." will be displayed,
<br />
75 if the client doesn't redirect immediatly.
</p>
76 <h2 id=
"http_send_data">bool http_send_data(string data)
</h2>
77 <p>Sends raw data with support for (multiple) range requests.
</p>
78 <h2 id=
"http_send_file">bool http_send_file(string file)
</h2>
79 <p>Sends a file with support for (multiple) range requests.
</p>
80 <h2 id=
"http_send_stream">bool http_send_stream(resource stream)
</h2>
81 <p>Sends an already opened stream with support for (multiple) range requests.
</p>
82 <h2 id=
"http_content_type">bool http_content_type([string content_type = 'application/x-octetstream'])
</h2>
83 <p>Sets the content type.
</p>
84 <h2 id=
"http_content_disposition">bool http_content_disposition(string filename[, bool inline = false])
</h2>
85 <p>Set the Content Disposition. The Content-Disposition header is very useful
<br />
86 if the data actually sent came from a file or something similar, that should
<br />
87 be
"saved" by the client/user (i.e. by browsers
"Save as..." popup window).
</p>
88 <h2 id=
"http_chunked_decode">string http_chunked_decode(string encoded)
</h2>
89 <p>This function decodes a string that was HTTP-chunked encoded.
<br />
90 Returns false on failure.
</p>
91 <h2 id=
"http_split_response">array http_split_response(string http_response)
</h2>
92 <p>This function splits an HTTP response into an array with headers and the
<br />
93 content body. The returned array may look simliar to the following example:
</p><p><pre><br />
96 'Status' =
> '
200 Ok',
<br />
97 'Content-Type' =
> 'text/plain',
<br />
98 'Content-Language' =
> 'en-US'
<br />
100 1 =
> "Hello World!"<br />
103 <h2 id=
"http_parse_headers">array http_parse_headers(string header) */
</h2>
105 <h2 id=
"http_get">string http_get(string url[, array options[, array &info]])
</h2>
106 <p>Performs an HTTP GET request on the supplied url.
</p><p>The second parameter is expected to be an associative
<br />
107 array where the following keys will be recognized:
<br />
109 - redirect: int, whether and how many redirects to follow
<br />
110 - unrestrictedauth: bool, whether to continue sending credentials on
<br />
111 redirects to a different host
<br />
112 - proxyhost: string, proxy host in
"host[:port]" format
<br />
113 - proxyport: int, use another proxy port as specified in proxyhost
<br />
114 - proxyauth: string, proxy credentials in
"user:pass" format
<br />
115 - proxyauthtype: int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM
<br />
116 - httpauth: string, http credentials in
"user:pass" format
<br />
117 - httpauthtype: int, HTTP_AUTH_BASIC, DIGEST and/or NTLM
<br />
118 - compress: bool, whether to allow gzip/deflate content encoding
<br />
119 (defaults to true)
<br />
120 - port: int, use another port as specified in the url
<br />
121 - referer: string, the referer to sends
<br />
122 - useragent: string, the user agent to send
<br />
123 (defaults to PECL::HTTP/version (PHP/version)))
<br />
124 - headers: array, list of custom headers as associative array
<br />
125 like array(
"header" =
> "value")
<br />
126 - cookies: array, list of cookies as associative array
<br />
127 like array(
"cookie" =
> "value")
<br />
128 - cookiestore: string, path to a file where cookies are/will be stored
<br />
129 </pre></p><p>The optional third parameter will be filled with some additional information
<br />
130 in form af an associative array, if supplied (don't forget to initialize it
<br />
131 with NULL or array()).
</p>
132 <h2 id=
"http_head">string http_head(string url[, array options[, array &info]])
</h2>
133 <p>Performs an HTTP HEAD request on the suppied url.
<br />
134 Returns the HTTP response as string.
<br />
135 See http_get() for a full list of available options.
</p>
136 <h2 id=
"http_post_data">string http_post_data(string url, string data[, array options[, &info]])
</h2>
137 <p>Performs an HTTP POST request, posting data.
<br />
138 Returns the HTTP response as string.
<br />
139 See http_get() for a full list of available options.
</p>
140 <h2 id=
"http_post_array">string http_post_array(string url, array data[, array options[, array &info]])
</h2>
141 <p>Performs an HTTP POST request, posting www-form-urlencoded array data.
<br />
142 Returns the HTTP response as string.
<br />
143 See http_get() for a full list of available options.
</p>
144 <h2 id=
"http_auth_basic">bool http_auth_basic(string user, string pass[, string realm =
"Restricted"])
</h2>
147 <code><font color=
"#000000"><br />
148 <font color=
"#0000BB"><?php
<br /></font><font color=
"#007700">if (!
</font><font color=
"#0000BB">http_auth_basic
</font><font color=
"#007700">(
</font><font color=
"#DD0000">'mike'
</font><font color=
"#007700">,
</font><font color=
"#DD0000">'s3c|r3t'
</font><font color=
"#007700">)) {
<br />die(
</font><font color=
"#DD0000">'
<h1
>Authorization failed!
</h1
>'
</font><font color=
"#007700">);
<br />}
<br /></font><font color=
"#0000BB">?
></font><br />
152 <h2 id=
"http_auth_basic_cb">bool http_auth_basic_cb(mixed callback[, string realm =
"Restricted"])
</h2>
155 <code><font color=
"#000000"><br />
156 <font color=
"#0000BB"><?php
<br /></font><font color=
"#007700">function
</font><font color=
"#0000BB">auth_cb
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$user
</font><font color=
"#007700">,
</font><font color=
"#0000BB">$pass
</font><font color=
"#007700">)
<br />{
<br />global
</font><font color=
"#0000BB">$db
</font><font color=
"#007700">;
<br /></font><font color=
"#0000BB">$query
</font><font color=
"#007700">=
</font><font color=
"#DD0000">'SELECT pass FROM users WHERE user='
</font><font color=
"#007700">.
</font><font color=
"#0000BB">$db
</font><font color=
"#007700">-
></font><font color=
"#0000BB">quoteSmart
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$user
</font><font color=
"#007700">);
<br />if (
</font><font color=
"#0000BB">strlen
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$realpass
</font><font color=
"#007700">=
</font><font color=
"#0000BB">$db
</font><font color=
"#007700">-
></font><font color=
"#0000BB">getOne
</font><font color=
"#007700">(
</font><font color=
"#0000BB">$query
</font><font color=
"#007700">)) {
<br />return
</font><font color=
"#0000BB">$pass
</font><font color=
"#007700">===
</font><font color=
"#0000BB">$realpass
</font><font color=
"#007700">;
<br />}
<br />return
</font><font color=
"#0000BB">false
</font><font color=
"#007700">;
<br />}
<br /><br />if (!
</font><font color=
"#0000BB">http_auth_basic_cb
</font><font color=
"#007700">(
</font><font color=
"#DD0000">'auth_cb'
</font><font color=
"#007700">)) {
<br />die(
</font><font color=
"#DD0000">'
<h1
>Authorization failed
</h1
>'
</font><font color=
"#007700">);
<br />}
<br /></font><font color=
"#0000BB">?
></font><br />
160 <hr noshade
><p><b> Generated at: Thu,
10 Feb
2005 19:
51:
45 +
0100</b></p>