From: Michael Wallner
Get a list of incoming HTTP headers.
+Get the raw request body (e.g. POST or PUT data).
Match an incoming HTTP header.
Generates a form-encoded query string from an associative array or object.
Instantiates a new HttpResponse object, which can be used to send
-any data/resource/file to an HTTP client with caching and multiple
-ranges/resuming support.
-
-NOTE: GZIPping is not implemented yet.
Whether it sould be attempted to cache the entitity.
-This will result in necessary caching headers and checks of clients
-"If-Modified-Since" and "If-None-Match" headers. If one of those headers
-matches a "304 Not Modified" status code will be issued.
-
-NOTE: If you're using sessions, be shure that you set session.cache_limiter
-to something more appropriate than "no-cache"!
Get current caching setting.
-Enable on-thy-fly gzipping of the sent entity. NOT IMPLEMENTED YET.
-Get current gzipping setting.
-Set a custom cache-control header, usually being "private" or "public"; if
-$raw is set to true the header will be sent as-is.
Get current Cache-Control header setting.
-Set the content-type of the sent entity.
-Get current Content-Type header setting.
-Set the Content-Disposition of the sent entity. This setting aims to suggest
-the receiveing user agent how to handle the sent entity; usually the client
-will show the user a "Save As..." popup.
Get current Content-Disposition setting.
-Will return an associative array like:
array(-
- 'filename' => 'foo.bar',
- 'inline' => false
-)
-
Set a custom ETag. Use this only if you know what you're doing.
-Get the previously set custom ETag.
-Set the data to be sent.
-Get the previously set data to be sent.
-Set the resource to be sent.
-Get the previously set resource to be sent.
-Set the file to be sent.
-Get the previously set file to be sent.
-Finally send the entity.
-
-Example:
+
-<?php
$r = new HttpResponse(true);
$r->setFile('../hidden/contract.pdf');
$r->setContentType('application/pdf');
$r->send();
?>
-
-
-
-
Instantiate a new HttpMessage object.
@@ -377,6 +305,8 @@ Returns false if version is invalid (1.0 and 1.1).Send the Message according to its type as Response or Request.
Get the string representation of the Message.
+Instantiate a new HttpRequest object which can be used to issue HEAD, GET
@@ -407,9 +337,9 @@ and POST (including posting files) HTTP requests.
Get previously set cookies.
Set the request URL.
-Get the previously set request URL.
Set the request methods; one of the HTTP_HEAD, HTTP_GET or
@@ -448,7 +378,7 @@ Affects only POST requests.
Add a file to the POST request.
Affects only POST requests.
Set files to post.
Overwrites previously set post files.
Affects only POST requests.
+
Instantiate a new HttpRequestPool object. An HttpRequestPool is
able to send several HttpRequests in parallel.
Example:
-<?php
$urls = array('www.php.net', 'pecl.php.net', 'pear.php.net')
$pool = new HttpRequestPool;
foreach ($urls as $url) {
$req[$url] = new HttpRequest("http://$url", HTTP_HEAD);
$pool->attach($req[$url]);
}
$pool->send();
foreach ($urls as $url) {
printf("%s (%s) is %s\n",
$url, $req[$url]->getResponseInfo('effective_url'),
$r->getResponseCode() == 200 ? 'alive' : 'not alive'
);
}
?>
+<?php
$urls = array('www.php.net', 'pecl.php.net', 'pear.php.net')
$pool = new HttpRequestPool;
foreach ($urls as $url) {
$req[$url] = new HttpRequest("http://$url", HTTP_HEAD);
$pool->attach($req[$url]);
}
$pool->send();
foreach ($urls as $url) {
printf("%s (%s) is %s\n",
$url, $req[$url]->getResponseInfo('effective_url'),
$r->getResponseCode() == 200 ? 'alive' : 'not alive'
);
}
?>
@@ -526,7 +458,80 @@ NOTE: set all options prior attaching!protected void HttpRequestPool::socketRead()
See HttpRequestPool::socketSend().
-Generated at: Tue, 14 Jun 2005 16:56:52 +0200
+http_response_object.c
+static bool HttpResponse::setCache(bool cache)
+Whether it sould be attempted to cache the entitity.
+
+This will result in necessary caching headers and checks of clients
+"If-Modified-Since" and "If-None-Match" headers. If one of those headers
+matches a "304 Not Modified" status code will be issued.
+
+NOTE: If you're using sessions, be shure that you set session.cache_limiter
+to something more appropriate than "no-cache"!static bool HttpResponse::getCache()
+Get current caching setting.
+static bool HttpResponse::setGzip(bool gzip)
+Enable on-thy-fly gzipping of the sent entity. NOT IMPLEMENTED YET.
+static bool HttpResponse::getGzip()
+Get current gzipping setting.
+static bool HttpResponse::setCacheControl(string control[, long max_age = 0])
+Set a custom cache-control header, usually being "private" or "public";
+
+The max_age parameter controls how long the cache entry is valid on the client side.static string HttpResponse::getCacheControl()
+Get current Cache-Control header setting.
+static bool HttpResponse::setContentType(string content_type)
+Set the content-type of the sent entity.
+static string HttpResponse::getContentType()
+Get current Content-Type header setting.
+static bool HttpResponse::setContentDisposition(string filename[, bool inline = false])
+Set the Content-Disposition of the sent entity. This setting aims to suggest
+
+the receiveing user agent how to handle the sent entity; usually the client
+will show the user a "Save As..." popup.static string HttpResponse::getContentDisposition()
+Get current Content-Disposition setting.
+static bool HttpResponse::setETag(string etag)
+Set a custom ETag. Use this only if you know what you're doing.
+static string HttpResponse::getETag()
+Get the previously set custom ETag.
+static void HttpResponse::setThrottleDelay(double seconds)
+ +static double HttpResponse::getThrottleDelay()
+ +static void HttpResponse::setBufferSize(long bytes)
+ +static long HttpResponse::getBufferSize()
+ +static bool HttpResponse::setData(string data)
+Set the data to be sent.
+static string HttpResponse::getData()
+Get the previously set data to be sent.
+static bool HttpResponse::setStream(resource stream)
+Set the resource to be sent.
+static resource HttpResponse::getStream()
+Get the previously set resource to be sent.
+static bool HttpResponse::setFile(string file)
+Set the file to be sent.
+static string HttpResponse::getFile()
+Get the previously set file to be sent.
+static bool HttpResponse::send([bool clean_ob = true])
+Finally send the entity.
+
+Example:+
+<?php
HttpResponse::setCache(true);
HttpResponse::setContentType('application/pdf');
HttpResponse::setContentDisposition("$user.pdf", false);
HttpResponse::setFile('sheet.pdf');
HttpResponse::send();
?>
+
+
+
+static void HttpResponse::capture()
+Capture script output.
+
+Example:+
+<?php
HttpResponse::setCache(true);
HttpResponse::capture();
// script follows
?>
+
+
+
+
+Generated at: Fri, 22 Jul 2005 17:44:59 +0200