PHP Doku:: HttpRequest constructor - function.httprequest-construct.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteHTTPThe HttpRequestHttpRequest::__construct

Ein Service von Reinhard Neidl - Webprogrammierung.

The HttpRequest

<<HttpRequest::clearHistory

HttpRequest::enableCookies>>

HttpRequest::__construct

(PECL pecl_http >= 0.10.0)

HttpRequest::__constructHttpRequest constructor

Beschreibung

public void HttpRequest::__construct ([ string $url [, int $request_method = HTTP_METH_GET [, array $options ]]] )

Instantiate a new HttpRequest object.

Parameter-Liste

url

the target request url

request_method

the request method to use

options

an associative array with request options

Fehler/Exceptions

Throws HttpException.


2 BenutzerBeiträge:
- Beiträge aktualisieren...
RLK
15.07.2010 22:51
You can use custom methods here if you use the undocumented HttpRequest::methodRegister()

<?php
HttpRequest
::methodRegister('foobar');
$r = new HttpRequest('http://www.php.net', HttpRequest::METH_FOOBAR);
?>
andychr17 at hotmail dot com
30.06.2008 4:34
I found that by not having a trailing slash (e.g. "http://www.google.com"), HttpRequest would tack on the URI of the script I was currently accessing.

An easy way to prevent this from happening is to include a trailing slash in the url. This way, "http://www.google.com" becomes "http://www.google.com/".



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)