Class Guzzle\Http\Client

InheritanceGuzzle\Http\Client » Guzzle\Common\AbstractHasDispatcher
ImplementsGuzzle\Common\HasDispatcherInterface, Guzzle\Http\ClientInterface
SubclassesGuzzle\Service\Client

HTTP client

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Guzzle\Http\Client
addSubscriber() Guzzle\Common\AbstractHasDispatcher
createRequest() Guzzle\Http\Client
delete() Guzzle\Http\Client
dispatch() Guzzle\Common\AbstractHasDispatcher
extractPharCacert() Copies the phar cacert from a phar into the temp directory. Guzzle\Http\Client
get() Guzzle\Http\Client
getAllEvents() Guzzle\Http\Client
getBaseUrl() Guzzle\Http\Client
getConfig() Guzzle\Http\Client
getCurlMulti() Guzzle\Http\Client
getDefaultHeaders() Guzzle\Http\Client
getDefaultOption() Retrieve a default request option from the client Guzzle\Http\Client
getDefaultUserAgent() Get the default User-Agent string to use with Guzzle Guzzle\Http\Client
getEventDispatcher() Guzzle\Common\AbstractHasDispatcher
head() Guzzle\Http\Client
options() Guzzle\Http\Client
patch() Guzzle\Http\Client
post() Guzzle\Http\Client
preparePharCacert() Guzzle\Http\Client
put() Guzzle\Http\Client
send() Guzzle\Http\Client
setBaseUrl() Guzzle\Http\Client
setConfig() Guzzle\Http\Client
setCurlMulti() Set a curl multi object to be used internally by the client for transferring requests. Guzzle\Http\Client
setDefaultHeaders() Guzzle\Http\Client
setDefaultOption() Set a default request option on the client that will be used as a default for each request Guzzle\Http\Client
setEventDispatcher() Guzzle\Common\AbstractHasDispatcher
setRequestFactory() Guzzle\Http\Client
setSslVerification() Guzzle\Http\Client
setUriTemplate() Set the URI template expander to use with the client Guzzle\Http\Client
setUserAgent() Guzzle\Http\Client

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
expandTemplate() Expand a URI template while merging client config settings into the template variables Guzzle\Http\Client
getUriTemplate() Get the URI template expander used by the client Guzzle\Http\Client
initSsl() Initializes SSL settings Guzzle\Http\Client
prepareRequest() Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request. Guzzle\Http\Client
sendMultiple() Send multiple requests in parallel Guzzle\Http\Client

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
CURL_OPTIONS 'curl.options' Guzzle\Http\Client
DEFAULT_SELECT_TIMEOUT 1.0 Guzzle\Http\Client
DISABLE_REDIRECTS \Guzzle\Http\RedirectPlugin::DISABLE Guzzle\Http\Client
MAX_HANDLES 3 Guzzle\Http\Client
REQUEST_OPTIONS 'request.options' Guzzle\Http\Client
REQUEST_PARAMS 'request.params' Guzzle\Http\Client
SSL_CERT_AUTHORITY 'ssl.certificate_authority' Guzzle\Http\Client

Property Details

$defaultHeaders protected property

Default HTTP headers to set on each request

$requestFactory protected property

Request factory used by the client

$userAgent protected property

The user agent string to set on each request

protected string $userAgent null

Method Details

__construct() public method

public void __construct ( $baseUrl '', $config null )
$baseUrl string

Base URL of the web service

$config array|Guzzle\Common\Collection

Configuration settings

throws Guzzle\Common\Exception\RuntimeException

if cURL is not installed

createRequest() public method

public void createRequest ( $method 'GET', $uri null, $headers null, $body null, array $options = [] )
$method
$uri
$headers
$body
$options
delete() public method

public void delete ( $uri null, $headers null, $body null, array $options = [] )
$uri
$headers
$body
$options
expandTemplate() protected method

Expand a URI template while merging client config settings into the template variables

protected string expandTemplate ( $template, array $variables null )
$template string

Template to expand

$variables array

Variables to inject

extractPharCacert() public static method

Copies the phar cacert from a phar into the temp directory.

public static string extractPharCacert ( $pharCacertPath )
$pharCacertPath string

Path to the phar cacert. For example:

                          'phar://aws.phar/Guzzle/Http/Resources/cacert.pem'
return string

Returns the path to the extracted cacert file.

throws RuntimeException

Throws if the phar cacert cannot be found or

                      the file cannot be copied to the temp dir.
get() public method

public void get ( $uri null, $headers null, $options = [] )
$uri
$headers
$options
getAllEvents() public static method

public static void getAllEvents ( )
getBaseUrl() public method

public void getBaseUrl ( $expand true )
$expand
getConfig() public method

public void getConfig ( $key false )
$key
getCurlMulti() public method

public Guzzle\Http\Curl\CurlMultiInterface|Guzzle\Http\Curl\CurlMultiProxy getCurlMulti ( )
getDefaultHeaders() public method

public void getDefaultHeaders ( )
getDefaultOption() public method

Retrieve a default request option from the client

public mixed|null getDefaultOption ( $keyOrPath )
$keyOrPath string

Request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo)

getDefaultUserAgent() public method

Get the default User-Agent string to use with Guzzle

public string getDefaultUserAgent ( )
getUriTemplate() protected method

Get the URI template expander used by the client

protected Guzzle\Parser\UriTemplate\UriTemplateInterface getUriTemplate ( )
head() public method

public void head ( $uri null, $headers null, array $options = [] )
$uri
$headers
$options
initSsl() protected method

Initializes SSL settings

protected void initSsl ( )
options() public method

public void options ( $uri null, array $options = [] )
$uri
$options
patch() public method

public void patch ( $uri null, $headers null, $body null, array $options = [] )
$uri
$headers
$body
$options
post() public method

public void post ( $uri null, $headers null, $postBody null, array $options = [] )
$uri
$headers
$postBody
$options
preparePharCacert() public method

public void preparePharCacert ( $md5Check true )
$md5Check
prepareRequest() protected method

Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request.

protected Guzzle\Http\Message\RequestInterface prepareRequest ( Guzzle\Http\Message\RequestInterface $request, array $options = [] )
$request Guzzle\Http\Message\RequestInterface

Request to prepare for the client

$options array

Options to apply to the request

put() public method

public void put ( $uri null, $headers null, $body null, array $options = [] )
$uri
$headers
$body
$options
send() public method

public void send ( $requests )
$requests
sendMultiple() protected method

Send multiple requests in parallel

protected array sendMultiple ( array $requests )
$requests array

Array of RequestInterface objects

return array

Returns an array of Response objects

setBaseUrl() public method

public void setBaseUrl ( $url )
$url
setConfig() public method

public void setConfig ( $config )
$config
setCurlMulti() public method

Set a curl multi object to be used internally by the client for transferring requests.

public self setCurlMulti ( Guzzle\Http\Curl\CurlMultiInterface $curlMulti )
$curlMulti Guzzle\Http\Curl\CurlMultiInterface

Multi object

setDefaultHeaders() public method

public void setDefaultHeaders ( $headers )
$headers
setDefaultOption() public method

Set a default request option on the client that will be used as a default for each request

public $this setDefaultOption ( $keyOrPath, $value )
$keyOrPath string

Request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo)

$value mixed

Value to set

setRequestFactory() public method

public void setRequestFactory ( Guzzle\Http\Message\RequestFactoryInterface $factory )
$factory
setSslVerification() public method

public void setSslVerification ( $certificateAuthority true, $verifyPeer true, $verifyHost 2 )
$certificateAuthority
$verifyPeer
$verifyHost
setUriTemplate() public method

Set the URI template expander to use with the client

public self setUriTemplate ( Guzzle\Parser\UriTemplate\UriTemplateInterface $uriTemplate )
$uriTemplate Guzzle\Parser\UriTemplate\UriTemplateInterface

URI template expander

setUserAgent() public method

public void setUserAgent ( $userAgent, $includeDefault false )
$userAgent
$includeDefault