Class \Scrivo\Utilities\RawRequest
Class to facilitate executing HTTP requests using raw header data.
Example usage:
// Get ready to send some requests over https: $rr = new RawRequest("https", "www.scrivo.nl");
// Retrieve some data using GET over https: $data = $rr->getResponse("GET https://www.scrivo.nl?arg=3 HTTP/1.1\r\n". "Host: www.scrivo.nl\r\n". "User-Agent: GetIt\r\n". "\r\n");
// Some data to post:
$data = "
// Send and retrieve some data using POST over https: $data = $rr->getResponse("POST https://www.scrivo.nl HTTP/1.1\r\n". "Host: www.scrivo.nl\r\n". "User-Agent: PostIt\r\n". "Content-Type: text/xml; charset=utf-8\r\n". "Content-Length: $contentlength\r\n". "\r\n$data");
Defined in: Utilities/RawRequest.php.
Attr. | Name / Description |
---|---|
public |
RawRequest($scheme, $host, $port) Create a RawRequest object that can be used for multiple requests to the same host. |
Attr. | Type | Name | Description |
---|---|---|---|
protected | string | $host | The host to send the request to. |
protected | int | $port | The port to send the request to. |
protected | string | $scheme | The scheme to use for the request. |
Attr. | Type | Name / Description |
---|---|---|
public | object |
Send raw header data to the specified host and get the raw response back. |
Constructor
- public RawRequest(string $scheme, string $host, int $port=null)
-
Create a RawRequest object that can be used for multiple requests to the same host.
Parameters:
Type Name Def. Description string $scheme The scheme to use (http or https).
string $host The name of the host to send the reqeusts to.
int $port null Optional: a specific port to send the request to, defaults to 80 (http) or 443 (https).
View source: Utilities/RawRequest.php line 89.
Members
- protected string $host
-
The host to send the request to.
View source: Utilities/RawRequest.php line 73.
- protected int $port
-
The port to send the request to.
View source: Utilities/RawRequest.php line 67.
- protected string $scheme
-
The scheme to use for the request.
View source: Utilities/RawRequest.php line 79.
Methods
- public object getResponse()
-
Send raw header data to the specified host and get the raw response back.
Parameters:
Type Name Def. Description $requstHeaders $requstHeaders Returns:
object Send raw header data to the specified host and get the raw response back.
Throws:
Exception Type Description \Scrivo\Utilities\Exception If there was a problem with opening, reading from or writing to the connection. View source: Utilities/RawRequest.php line 113.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013