80 private $method =
null;
87 private static $httpClient;
97 function __construct($url, $method =
'GET', $params =
null, $header =
null)
100 $this->method = strtoupper($method);
101 if (is_array($params)) {
102 $this->request = http_build_query($params);
104 $this->request = $params;
106 if (!empty($header)) {
107 $this->requestHeaders = explode(
"\n", $header);
128 return $this->method;
138 self::$httpClient = $httpClient;
148 if (!self::$httpClient) {
149 if (function_exists(
'curl_init')) {
151 } elseif (ini_get(
'allow_url_fopen')) {
156 return self::$httpClient;
167 $this->ok = !empty($client);
169 $this->ok = $client->send($this);
171 $this->error =
'No HTTP client interface is available';
$status
Status of response (0 if undetermined).
getUrl()
Get the target URL for the request.
__construct($url, $method='GET', $params=null, $header=null)
Class constructor.
getMethod()
Get the HTTP method for the request.
static getHttpClient()
Get the HTTP client to use for sending the message.
send()
Send the request to the target URL.
$responseHeaders
Response headers.
Class to implement the HTTP message interface using the Curl library.
Class to represent an HTTP message request.
Class to implement the HTTP message interface using a file stream.
static setHttpClient($httpClient=null)
Set the HTTP client to use for sending the message.
$ok
True if message was processed successfully.
Interface to represent an HTTP message client.
$requestHeaders
Request headers.