Page MenuHomePhabricator

final class HTTPFuture
libphutil Technical Documentation (Futures)

Socket-based HTTP future, for making HTTP requests using future semantics. This is an alternative to CURLFuture which has better resolution behavior (select()-based wait instead of busy wait) but fewer features. You should prefer this class to CURLFuture unless you need its advanced features (like HTTP/1.1, chunked transfer encoding, gzip, etc.).

Example Usage

$future = new HTTPFuture('http://www.example.com/');
list($response_body, $headers) = $future->resolvex();

Or

$future = new HTTPFuture('http://www.example.com/');
list($http_response_status_object,
     $response_body,
     $headers) = $future->resolve();

Prefer resolvex() to resolve() as the former throws HTTPFutureHTTPResponseStatus on failures, which includes an informative exception message.

Methods

public function setURI($uri)

This method is not documented.
Parameters
$uri
Return
wild

public function __destruct()

This method is not documented.
Return
wild

public function getReadSockets()

This method is not documented.
Return
wild

public function getWriteSockets()

This method is not documented.
Return
wild

public function isWriteComplete()

This method is not documented.
Return
wild

private function getDefaultUserAgent()

This method is not documented.
Return
wild

public function isReady()

This method is not documented.
Return
wild

private function buildSocket()

This method is not documented.
Return
wild

private function checkSocket()

This method is not documented.
Return
wild

private function buildErrorResult($error)

This method is not documented.
Parameters
$error
Return
wild

private function buildHTTPRequest()

This method is not documented.
Return
wild
This method is not documented.
Return
wild