X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=docs%2Ffunctions.html;h=fa3d1c5d301efc799c1db0f723f2d7195fc6d690;hb=7fef44c902c86eebce30f36003a27905fbaeba65;hp=b815071d31a3cf5b33523658f2e578956c086127;hpb=0acbfc76b5a3e4122a6d06d64bd834a810806656;p=m6w6%2Fext-http diff --git a/docs/functions.html b/docs/functions.html index b815071..fa3d1c5 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -81,7 +81,7 @@ The host will be taken either from the Host HTTP header of the client
the SERVER_NAME or just localhost if prior are not available.
If a port is pecified in either the url or as sperate parameter,
it will be added if it differs from te default port for HTTP(S).

-

Returns the absolute URI as string.

+

Returns the absolute URI as string on success or false on failure.

Examples:


<?php
$uri 
http_build_uri("page.php""https"NULL488);
?>

@@ -569,7 +569,7 @@ pairs to add.

bool HttpRequest::setMethod(int request_method)

Set the request method.

Expects an int as parameter specifying the request method to use.
-In PHP 5.1+ HttpRequest::METH, otherwise the HTTP_METH constants can be used.

+In PHP 5.1+ HttpRequest::METH_*, otherwise the HTTP_METH_* constants can be used.

Returns TRUE on success, or FALSE on failure.

int HttpRequest::getMethod()

Get the previously set request method.

@@ -745,11 +745,11 @@ HttpRequest::getResponse*() methods.

Throws HttpRuntimeException, HttpRequestException,
HttpMalformedHeaderException, HttpEncodingException.

GET example:


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

POST example:


-<?php
$r 
= new HttpRequest('http://example.com/form.php'HTTP_POST);
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostFields(array('user' => 'mike''pass' => 's3c|r3t'));
$r->addPostFile('image''profile.jpg''image/jpeg');
try {
    echo 
$r->send()->getBody();
} catch (
HttpException $ex) {
    echo 
$ex;
}
?>
+<?php
$r 
= new HttpRequest('http://example.com/form.php'HttpRequest::METH_POST);
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostFields(array('user' => 'mike''pass' => 's3c|r3t'));
$r->addPostFile('image''profile.jpg''image/jpeg');
try {
    echo 
$r->send()->getBody();
} catch (
HttpException $ex) {
    echo 
$ex;
}
?>


@@ -762,7 +762,7 @@ able to send several HttpRequests in parallel.

object while you're using the implemented Interator interface.

Accepts virtual infinite optional parameters each referencing an
HttpRequest object.

-

Throws HttpRequestException, HttpRequestPoolException, HttpInvalidParamException.

+

Throws HttpRequestPoolException (HttpRequestException, HttpInvalidParamException).

Example:


<?php
try {
    
$pool = new HttpRequestPool(
        new 
HttpRequest('http://www.google.com/'HttpRequest::METH_HEAD),
        new 
HttpRequest('http://www.php.net/'HttpRequest::METH_HEAD)
    );
    
$pool->send();
    foreach(
$pool as $request) {
        
printf("%s is %s (%d)\n",
            
$request->getUrl(),
            
$request->getResponseCode() ? 'alive' 'not alive',
            
$request->getResponseCode()
        );
    }
} catch (
HttpException $e) {
    echo 
$e;
}
?>

@@ -788,8 +788,7 @@ HttpRequestPool object.

bool HttpRequestPool::send()

Send all attached HttpRequest objects in parallel.

Returns TRUE on success, or FALSE on failure.

-

Throws HttpSocketException, HttpRequestException,
-HttpRequestPoolException, HttpMalformedHeaderException.

+

Throws HttpRequestPoolException (HttpSocketException, HttpRequestException, HttpMalformedHeaderException).

protected bool HttpRequestPool::socketPerform()

Returns TRUE until each request has finished its transaction.

Usage:


@@ -1201,7 +1200,7 @@ http.cache_log is set.

-

Generated at: Mon, 21 Nov 2005 16:56:18 +0100

+

Generated at: Fri, 09 Dec 2005 13:56:42 +0100