From 0f08208cc1b223ccb90554718181d553156997f4 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 22 Mar 2005 14:41:53 +0000 Subject: [PATCH] - updating docs --- docs/functions.html | 117 +++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/docs/functions.html b/docs/functions.html index 2b0af4c..dc97a61 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -1,6 +1,3 @@ -Content-type: text/html -X-Powered-By: PHP/5.0.1 - Function Summary of ext/http @@ -226,13 +223,13 @@ See http_get() for a full list of available options.

Generates a form-encoded query string from an associative array or object.


http_methods.c

-

void HTTPi_Response::__construct(bool cache, bool gzip)

-

Instantiates a new HTTPi_Response object, which can be used to send
+

void HttpResponse::__construct(bool cache, bool gzip)

+

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.

-

bool HTTPi_Response::setCache(bool cache)

+

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
@@ -240,137 +237,143 @@ 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"!

-

bool HTTPi_Response::getCache()

+

bool HttpResponse::getCache()

Get current caching setting.

-

bool HTTPi_Response::setGzip(bool gzip)

+

bool HttpResponse::setGzip(bool gzip)

Enable on-thy-fly gzipping of the sent entity. NOT IMPLEMENTED YET.

-

bool HTTPi_Response::getGzip()

+

bool HttpResponse::getGzip()

Get current gzipping setting.

-

bool HTTPi_Response::setCacheControl(string control[, bool raw = false])

+

bool HttpResponse::setCacheControl(string control[, bool raw = false])

Set a custom cache-control header, usually being "private" or "public"; if
$raw is set to true the header will be sent as-is.

-

string HTTPi_Response::getCacheControl()

+

string HttpResponse::getCacheControl()

Get current Cache-Control header setting.

-

bool HTTPi_Response::setContentType(string content_type)

+

bool HttpResponse::setContentType(string content_type)

Set the content-type of the sent entity.

-

string HTTPi_Response::getContentType()

+

string HttpResponse::getContentType()

Get current Content-Type header setting.

-

bool HTTPi_Response::setContentDisposition(string filename[, bool inline = false])

+

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.

-

array HTTPi_Response::getContentDisposition()

+

array HttpResponse::getContentDisposition()

Get current Content-Disposition setting.
Will return an associative array like:

array(
'filename' => 'foo.bar',
'inline' => false
)

-

bool HTTPi_Response::setETag(string etag)

+

bool HttpResponse::setETag(string etag)

Set a custom ETag. Use this only if you know what you're doing.

-

string HTTPi_Response::getETag()

+

string HttpResponse::getETag()

Get the previously set custom ETag.

-

bool HTTPi_Response::setData(string data)

+

bool HttpResponse::setData(string data)

Set the data to be sent.

-

string HTTPi_Response::getData()

+

string HttpResponse::getData()

Get the previously set data to be sent.

-

bool HTTPi_Response::setStream(resource stream)

+

bool HttpResponse::setStream(resource stream)

Set the resource to be sent.

-

resource HTTPi_Response::getStream()

+

resource HttpResponse::getStream()

Get the previously set resource to be sent.

-

bool HTTPi_Response::setFile(string file)

+

bool HttpResponse::setFile(string file)

Set the file to be sent.

-

string HTTPi_Response::getFile()

+

string HttpResponse::getFile()

Get the previously set file to be sent.

-

bool HTTPi_Response::send()

+

bool HttpResponse::send()

Finally send the entity.

Example:


-<?php
$r
= new HTTPi_Response(true);
$r->setFile('../hidden/contract.pdf');
$r->setContentType('application/pdf');
$r->send();
?>
+<?php
$r
= new HttpResponse(true);
$r->setFile('../hidden/contract.pdf');
$r->setContentType('application/pdf');
$r->send();
?>



-

void HTTPi_Request::__construct([string url[, long request_method = HTTP_GET]])

-

Instantiate a new HTTPi_Request object which can be used to issue HEAD, GET
+

void HttpRequest::__construct([string url[, long request_method = HTTP_GET]])

+

Instantiate a new HttpRequest object which can be used to issue HEAD, GET
and POST (including posting files) HTTP requests.

-

void HTTPi_Request::__destruct()

-

Destroys the HTTPi_Request object.

-

bool HTTPi_Request::setOptions(array options)

+

void HttpRequest::__destruct()

+

Destroys the HttpRequest object.

+

bool HttpRequest::setOptions(array options)

Set the request options to use. See http_get() for a full list of available options.

-

array HTTPi_Request::getOptions()

+

array HttpRequest::getOptions()

Get current set options.

-

bool HTTPi_Request::setURL(string url)

+

void HttpRequest::unsetOptions()

+

Unset all options/headers/cookies.

+

bool HttpRequest::addHeader(array header)

+

Add (a) request header name/value pair(s).

+

bool HttpRequest::addCookie(array cookie)

+

Add (a) cookie(s).

+

bool HttpRequest::setURL(string url)

Set the request URL.

-

string HTTPi_Request::getUrl()

+

string HttpRequest::getUrl()

Get the previously set request URL.

-

bool HTTPi_Request::setMethod(long request_method)

+

bool HttpRequest::setMethod(long request_method)

Set the request methods; one of the HTTP_HEAD, HTTP_GET or
HTTP_POST constants.

-

long HTTPi_Request::getMethod()

+

long HttpRequest::getMethod()

Get the previously set request method.

-

bool HTTPi_Request::setContentType(string content_type)

+

bool HttpRequest::setContentType(string content_type)

Set the content type the post request should have.
Use this only if you know what you're doing.

-

string HTTPi_Request::getContentType()

+

string HttpRequest::getContentType()

Get the previously content type.

-

bool HTTPi_Request::setQueryData(mixed query_data)

+

bool HttpRequest::setQueryData(mixed query_data)

Set the URL query parameters to use.
Overwrites previously set query parameters.
Affects any request types.

-

string HTTPi_Request::getQueryData()

+

string HttpRequest::getQueryData()

Get the current query data in form of an urlencoded query string.

-

bool HTTPi_Request::addQueryData(array query_params)

+

bool HttpRequest::addQueryData(array query_params)

Add parameters to the query parameter list.
Affects any request type.

-

void HTTPi_Request::unsetQueryData()

+

void HttpRequest::unsetQueryData()

Clean the query parameters.
Affects any request type.

-

bool HTTPi_Request::addPostData(array post_data)

+

bool HttpRequest::addPostData(array post_data)

Adds POST data entries.
Affects only POST requests.

-

bool HTTPi_Request::setPostData(array post_data)

+

bool HttpRequest::setPostData(array post_data)

Set the POST data entries.
Overwrites previously set POST data.
Affects only POST requests.

-

array HTTPi_Request::getPostData()

+

array HttpRequest::getPostData()

Get previously set POST data.

-

void HTTPi_Request::unsetPostData()

+

void HttpRequest::unsetPostData()

Clean POST data entires.
Affects only POST requests.

-

bool HTTPi_Request::addPostFile(string name, string file[, string content_type = "application/x-octetstream"])

+

bool HttpRequest::addPostFile(string name, string file[, string content_type = "application/x-octetstream"])

Add a file to the POST request.
Affects only POST requests.

-

array HTTPi_Request::getPostFiles()

+

array HttpRequest::getPostFiles()

Get all previously added POST files.

-

void HTTPi_Request::unsetPostFiles()

+

void HttpRequest::unsetPostFiles()

Unset the POST files list.
Affects only POST requests.

-

array HTTPi_Request::getResponseData()

+

array HttpRequest::getResponseData()

Get all response data after the request has been sent.

-

string HTTPi_Request::getResponseHeader([string name])

+

string HttpRequest::getResponseHeader([string name])

Get response header(s) after the request has been sent.

-

string HTTPi_Request::getResponseBody()

+

string HttpRequest::getResponseBody()

Get the response body after the request has been sent.

-

int HTTPi_Request::getResponseCode()

+

int HttpRequest::getResponseCode()

Get the response code after the request has been sent.

-

array HTTPi_Request::getResponseInfo([string name])

+

array HttpRequest::getResponseInfo([string name])

Get response info after the request has been sent.
See http_get() for a full list of returned info.

-

bool HTTPi_Request::send()

+

bool HttpRequest::send()

Send the HTTP request.

GET example:


-<?php
$r
= new HTTPi_Request('http://example.com/feed.rss', HTTP_GET);
$r->setOptions(array('lastmodified' => filemtime('local.rss')));
$r->addQueryData(array('category' => 3));
if (
$r->send() && $r->getResponseCode() == 200) {
    
file_put_contents('local.rss', $r->getResponseBody());
}
?>
+<?php
$r
= new HttpRequest('http://example.com/feed.rss', HTTP_GET);
$r->setOptions(array('lastmodified' => filemtime('local.rss')));
$r->addQueryData(array('category' => 3));
if (
$r->send() && $r->getResponseCode() == 200) {
    
file_put_contents('local.rss', $r->getResponseBody());
}
?>

POST example:


-<?php
$r
= new HTTPi_Request('http://example.com/form.php', HTTP_POST);
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostData(array('user' => 'mike', 'pass' => 's3c|r3t'));
$r->addPostFile('image', 'profile.jpg', 'image/jpeg');
if (
$r->send()) {
    echo
$r->getResponseBody();
}
?>
+<?php
$r
= new HttpRequest('http://example.com/form.php', HTTP_POST);
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostData(array('user' => 'mike', 'pass' => 's3c|r3t'));
$r->addPostFile('image', 'profile.jpg', 'image/jpeg');
if (
$r->send()) {
    echo
$r->getResponseBody();
}
?>




-

Generated at: Mon, 7 Mar 2005 14:09:33 +0100

+

Generated at: Tue, 22 Mar 2005 15:41:10 +0100

-- 2.30.2