Inherited Variables
Inherited Constants
Inherited Methods
Class Details
HTTP Request information
This object can be used to easily access information about an HTTP request. It can additionally be used to create 'mock' requests.
This class mostly operates indepentend, but because of the nature of a single request per run it can operate as a singleton. For more information check out the behaviour around 'defaultInputStream'.
Tags:
- author - Evert Pot (http://www.rooftopsolutions.nl/)
- copyright - Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- license - Modified BSD License
[ Top ]
Class Variables
static $defaultInputStream = null
[line 44]
This will be set as the 'default' inputStream for a specific HTTP request We sometimes need to retain, or rebuild this if we need multiple runs of parsing the original HTTP request.
Type: resource
Overrides:
[ Top ]
$body = null
[line 35]
The request body, if any.
This is stored in the form of a stream resource.
Tags:
- access - protected
Type: resource
Overrides:
[ Top ]
$_SERVER
[line 26]
PHP's $_SERVER data
Tags:
- access - protected
Type: string
Overrides:
[ Top ]
Class Methods
__construct
Sabre_HTTP_Request __construct(
[array
$serverData = null])
[line 54]
Sets up the object
The serverData array can be used to override usage of PHP's global _SERVER variable.
Tags:
- access - public
Parameters:
- array $serverData -
[ Top ]
getAbsoluteUri
void getAbsoluteUri(
)
[line 128]
Will return protocol + the hostname + the uri
Tags:
- access - public
Parameters:
[ Top ]
getBody
resource getBody(
[bool
$asString = false])
[line 156]
Returns the HTTP request body body
This method returns a readable stream resource. If the asString parameter is set to true, a string is sent instead.
Tags:
- access - public
Parameters:
- bool $asString - asString
[ Top ]
getHeader
string getHeader(
string
$name)
[line 69]
Returns the value for a specific http header.
This method returns null if the header did not exist.
Tags:
- access - public
Parameters:
- string $name -
[ Top ]
getHeaders
array getHeaders(
)
[line 84]
Returns all (known) HTTP headers.
All headers are converted to lower-case, and additionally all underscores are automatically converted to dashes
Tags:
- access - public
Parameters:
[ Top ]
getMethod
string getMethod(
)
[line 106]
Returns the HTTP request method
This is for example POST or GET
Tags:
- access - public
Parameters:
[ Top ]
getQueryString
string getQueryString(
)
[line 141]
Returns everything after the ? from the current url
Tags:
- access - public
Parameters:
[ Top ]
getRawServerValue
string getRawServerValue(
string
$field)
[line 213]
Returns a specific item from the _SERVER array.
Do not rely on this feature, it is for internal use only.
Tags:
- access - public
Parameters:
- string $field -
[ Top ]
getUri
string getUri(
)
[line 117]
Returns the requested uri
Tags:
- access - public
Parameters:
[ Top ]
setBody
void setBody(
mixed
$body, [bool
$setAsDefaultInputStream = false])
[line 187]
Sets the contents of the HTTP requet body
This method can either accept a string, or a readable stream resource.
If the setAsDefaultInputStream is set to true, it means for this run of the script the supplied body will be used instead of php://input.
Tags:
- access - public
Parameters:
- mixed $body -
- bool $setAsDefaultInputStream -
[ Top ]