AWS SDK for PHP
  • Namespace
  • Class
  • Tree
  • Download

Namespaces

  • Aws
    • AutoScaling
      • Enum
      • Exception
    • CloudFormation
      • Enum
      • Exception
    • CloudFront
      • Enum
      • Exception
    • CloudFront_2012_05_05
    • CloudHsm
      • Exception
    • CloudSearch
      • Enum
      • Exception
    • CloudSearch_2011_02_01
    • CloudSearchDomain
      • Exception
    • CloudTrail
      • Exception
    • CloudWatch
      • Enum
      • Exception
    • CloudWatchLogs
      • Exception
    • CodeCommit
      • Exception
    • CodeDeploy
      • Exception
    • CodePipeline
      • Exception
    • CognitoIdentity
      • Exception
    • CognitoSync
      • Exception
    • Common
      • Client
      • Command
      • Credentials
      • Enum
      • Exception
        • Parser
      • Hash
      • InstanceMetadata
        • Waiter
      • Iterator
      • Model
        • MultipartUpload
      • Signature
      • Waiter
    • ConfigService
      • Exception
    • DataPipeline
      • Enum
      • Exception
    • DeviceFarm
      • Exception
    • DirectConnect
      • Enum
      • Exception
    • DirectoryService
      • Exception
    • DynamoDb
      • Enum
      • Exception
      • Model
        • BatchRequest
      • Session
        • LockingStrategy
    • DynamoDb_2011_12_05
    • DynamoDbStreams
      • Exception
    • Ec2
      • Enum
      • Exception
      • Iterator
    • Ecs
      • Exception
    • Efs
      • Exception
    • ElastiCache
      • Enum
      • Exception
    • ElasticBeanstalk
      • Enum
      • Exception
    • ElasticFileSystem
    • ElasticLoadBalancing
      • Exception
    • ElasticTranscoder
      • Exception
    • Emr
      • Enum
      • Exception
    • Glacier
      • Enum
      • Exception
      • Model
        • MultipartUpload
    • Iam
      • Enum
      • Exception
    • ImportExport
      • Enum
      • Exception
    • Kinesis
      • Enum
      • Exception
    • Kms
      • Exception
    • Lambda
      • Exception
    • MachineLearning
      • Exception
    • OpsWorks
      • Enum
      • Exception
    • Rds
      • Enum
      • Exception
    • Redshift
      • Enum
      • Exception
    • Route53
      • Enum
      • Exception
    • Route53Domains
      • Exception
    • S3
      • Command
      • Enum
      • Exception
        • Parser
      • Iterator
      • Model
        • MultipartUpload
      • Sync
    • Ses
      • Enum
      • Exception
    • SimpleDb
      • Exception
    • Sns
      • Exception
      • MessageValidator
        • Exception
    • Sqs
      • Enum
      • Exception
    • Ssm
      • Exception
    • StorageGateway
      • Enum
      • Exception
    • Sts
      • Exception
    • Support
      • Exception
    • Swf
      • Enum
      • Exception
    • WorkSpaces
      • Exception
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP

Classes

  • AbstractEntityBodyDecorator
  • CachingEntityBody
  • Client
  • EntityBody
  • IoEmittingEntityBody
  • Mimetypes
  • QueryString
  • ReadLimitEntityBody
  • RedirectPlugin
  • StaticClient
  • Url

Interfaces

  • ClientInterface
  • EntityBodyInterface
NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

Class Client

HTTP client

Guzzle\Common\AbstractHasDispatcher implements Guzzle\Common\HasDispatcherInterface
Extended by Guzzle\Http\Client implements Guzzle\Http\ClientInterface

Direct known subclasses

Guzzle\Service\Client

Indirect known subclasses

Aws\AutoScaling\AutoScalingClient, Aws\CloudFormation\CloudFormationClient, Aws\CloudWatchLogs\CloudWatchLogsClient, Aws\CodeCommit\CodeCommitClient, Aws\CodeDeploy\CodeDeployClient, Aws\CodePipeline\CodePipelineClient, Aws\CognitoIdentity\CognitoIdentityClient, Aws\CognitoSync\CognitoSyncClient, Aws\Common\Client\AbstractClient, Aws\Common\Client\DefaultClient, Aws\Common\InstanceMetadata\InstanceMetadataClient, Aws\ConfigService\ConfigServiceClient, Aws\CloudFront\CloudFrontClient, Aws\DataPipeline\DataPipelineClient, Aws\DeviceFarm\DeviceFarmClient, Aws\DirectConnect\DirectConnectClient, Aws\DirectoryService\DirectoryServiceClient, Aws\DynamoDb\DynamoDbClient, Aws\DynamoDb_2011_12_05\DynamoDbClient, Aws\DynamoDbStreams\DynamoDbStreamsClient, Aws\Ec2\Ec2Client, Aws\Ecs\EcsClient, Aws\Efs\EfsClient, Aws\CloudFront_2012_05_05\CloudFrontClient, Aws\ElastiCache\ElastiCacheClient, Aws\ElasticBeanstalk\ElasticBeanstalkClient, Aws\ElasticFileSystem\ElasticFileSystemClient, Aws\ElasticLoadBalancing\ElasticLoadBalancingClient, Aws\ElasticTranscoder\ElasticTranscoderClient, Aws\Emr\EmrClient, Aws\Glacier\GlacierClient, Aws\Iam\IamClient, Aws\ImportExport\ImportExportClient, Aws\Kinesis\KinesisClient, Aws\CloudHsm\CloudHsmClient, Aws\Kms\KmsClient, Aws\Lambda\LambdaClient, Aws\MachineLearning\MachineLearningClient, Aws\OpsWorks\OpsWorksClient, Aws\Rds\RdsClient, Aws\Redshift\RedshiftClient, Aws\Route53\Route53Client, Aws\Route53Domains\Route53DomainsClient, Aws\S3\S3Client, Aws\Ses\SesClient, Aws\CloudSearch\CloudSearchClient, Aws\SimpleDb\SimpleDbClient, Aws\Sns\SnsClient, Aws\Sqs\SqsClient, Aws\Ssm\SsmClient, Aws\StorageGateway\StorageGatewayClient, Aws\Sts\StsClient, Aws\Support\SupportClient, Aws\Swf\SwfClient, Aws\WorkSpaces\WorkSpacesClient, Aws\CloudSearch_2011_02_01\CloudSearchClient, Aws\CloudSearchDomain\CloudSearchDomainClient, Aws\CloudTrail\CloudTrailClient, Aws\CloudWatch\CloudWatchClient

Namespace: Guzzle\Http
Located at Guzzle/Http/Client.php

Methods summary

  • public static getAllEvents ( )

    Get a list of all of the events emitted from the class

  • public __construct ( string $baseUrl = '', array|Collection $config = null )
  • final public setConfig ( array|Collection $config )

    Set the configuration object to use with the client

  • final public getConfig ( bool|string $key = false )

    Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client.

  • public setDefaultOption ( string $keyOrPath, mixed $value )

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

  • public getDefaultOption ( string $keyOrPath )

    Retrieve a default request option from the client

  • final public setSslVerification ( string|bool $certificateAuthority = true, bool $verifyPeer = true, int $verifyHost = 2 )

    Set SSL verification options.

  • public createRequest ( string $method = 'GET', string|array $uri = null, array|Collection $headers = null, string|resource|array|EntityBodyInterface $body = null, array $options = array() )

    Create and return a new Guzzle\Http\Message\RequestInterface configured for the client.

  • public getBaseUrl ( bool $expand = true )

    Get the client's base URL as either an expanded or raw URI template

  • public setBaseUrl ( string $url )

    Set the base URL of the client

  • public setUserAgent ( string $userAgent, bool $includeDefault = false )

    Set the User-Agent header to be used on all requests from the client

  • public getDefaultUserAgent ( )

    Get the default User-Agent string to use with Guzzle

  • public get ( string|array $uri = null, array|Collection $headers = null, array $options = array() )

    Create a GET request for the client

  • public head ( string|array $uri = null, array|Collection $headers = null, array $options = array() )

    Create a HEAD request for the client

  • public delete ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )

    Create a DELETE request for the client

  • public put ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )

    Create a PUT request for the client

  • public patch ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )

    Create a PATCH request for the client

  • public post ( string|array $uri = null, array|Collection $headers = null, array|Collection|string|EntityBodyInterface $postBody = null, array $options = array() )

    Create a POST request for the client

  • public options ( string|array $uri = null, array $options = array() )

    Create an OPTIONS request for the client

  • public send ( array|RequestInterface $requests )

    Sends a single request or an array of requests in parallel

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

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

  • public getCurlMulti ( )
  • public setRequestFactory ( Guzzle\Http\Message\RequestFactoryInterface $factory )
  • public setUriTemplate ( Guzzle\Parser\UriTemplate\UriTemplateInterface $uriTemplate )

    Set the URI template expander to use with the client

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

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

  • protected getUriTemplate ( )

    Get the URI template expander used by the client

  • protected sendMultiple ( array $requests )

    Send multiple requests in parallel

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

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

  • protected initSsl ( )

    Initializes SSL settings

  • public static extractPharCacert ( string $pharCacertPath )

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

Methods detail

# public static array
getAllEvents( )

Get a list of all of the events emitted from the class

Returns

array

Overrides

Guzzle\Common\AbstractHasDispatcher::getAllEvents

Implementation of

Guzzle\Common\HasDispatcherInterface::getAllEvents()
# public
__construct( string $baseUrl = '', array|Guzzle\Common\Collection $config = null )

Parameters

$baseUrl
string
$baseUrl Base URL of the web service
$config
array|Guzzle\Common\Collection
$config Configuration settings

Throws

Guzzle\Common\Exception\RuntimeException
if cURL is not installed
# final public Guzzle\Http\Client
setConfig( array|Guzzle\Common\Collection $config )

Set the configuration object to use with the client

Parameters

$config
array|Guzzle\Common\Collection
$config Parameters that define how the client behaves

Returns

Guzzle\Http\Client

Implementation of

Guzzle\Http\ClientInterface::setConfig()
# final public mixed|Guzzle\Common\Collection
getConfig( boolean|string $key = false )

Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client.

A client should honor the following special values:

  • request.options: Associative array of default RequestFactory options to apply to each request
  • request.params: Associative array of request parameters (data values) to apply to each request
  • curl.options: Associative array of cURL configuration settings to apply to each request
  • ssl.certificate_authority: Path a CAINFO, CAPATH, true to use strict defaults, or false to disable verification
  • redirect.disable: Set to true to disable redirects

Parameters

$key
boolean|string
$key Configuration value to retrieve. Set to FALSE to retrieve all values of the client. The object return can be modified, and modifications will affect the client's config.

Returns

mixed|Guzzle\Common\Collection

See

\Guzzle\Http\Message\RequestFactoryInterface::applyOptions for a full list of request.options options

Implementation of

Guzzle\Http\ClientInterface::getConfig()
# public mixed
setDefaultOption( string $keyOrPath, mixed $value )

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

Parameters

$keyOrPath
string
$keyOrPath request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo)
$value
mixed
$value Value to set

Returns

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

Retrieve a default request option from the client

Parameters

$keyOrPath
string
$keyOrPath request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo)

Returns

mixed|null
# final public Guzzle\Http\Client
setSslVerification( string|boolean $certificateAuthority = true, boolean $verifyPeer = true, integer $verifyHost = 2 )

Set SSL verification options.

Setting $certificateAuthority to TRUE will result in the bundled cacert.pem being used to verify against the remote host.

Alternate certificates to verify against can be specified with the $certificateAuthority option set to the full path to a certificate file, or the path to a directory containing certificates.

Setting $certificateAuthority to FALSE will turn off peer verification, unset the bundled cacert.pem, and disable host verification. Please don't do this unless you really know what you're doing, and why you're doing it.

Parameters

$certificateAuthority
string|boolean
$certificateAuthority bool, file path, or directory path
$verifyPeer
boolean
$verifyPeer FALSE to stop from verifying the peer's certificate.
$verifyHost
integer
$verifyHost Set to 1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided.

Returns

Guzzle\Http\Client

Implementation of

Guzzle\Http\ClientInterface::setSslVerification()
# public Guzzle\Http\Message\RequestInterface
createRequest( string $method = 'GET', string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|array|Guzzle\Http\EntityBodyInterface $body = null, array $options = array() )

Create and return a new Guzzle\Http\Message\RequestInterface configured for the client.

Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URI can contain the query string as well. Use an array to provide a URI template and additional variables to use in the URI template expansion.

Parameters

$method
string
$method HTTP method. Defaults to GET
$uri
string|array
$uri Resource URI.
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|array|Guzzle\Http\EntityBodyInterface
$body Entity body of request (POST/PUT) or response (GET)
$options
array
$options Array of options to apply to the request

Returns

Guzzle\Http\Message\RequestInterface

Throws

Guzzle\Common\Exception\InvalidArgumentException
if a URI array is passed that does not contain exactly two elements: the URI followed by template variables

Implementation of

Guzzle\Http\ClientInterface::createRequest()
# public string|null
getBaseUrl( boolean $expand = true )

Get the client's base URL as either an expanded or raw URI template

Parameters

$expand
boolean
$expand Set to FALSE to get the raw base URL without URI template expansion

Returns

string|null

Implementation of

Guzzle\Http\ClientInterface::getBaseUrl()
# public Guzzle\Http\Client
setBaseUrl( string $url )

Set the base URL of the client

Parameters

$url
string
$url The base service endpoint URL of the webservice

Returns

Guzzle\Http\Client

Implementation of

Guzzle\Http\ClientInterface::setBaseUrl()
# public Guzzle\Http\Client
setUserAgent( string $userAgent, boolean $includeDefault = false )

Set the User-Agent header to be used on all requests from the client

Parameters

$userAgent
string
$userAgent User agent string
$includeDefault
boolean
$includeDefault Set to true to prepend the value to Guzzle's default user agent string

Returns

Guzzle\Http\Client

Implementation of

Guzzle\Http\ClientInterface::setUserAgent()
# public string
getDefaultUserAgent( )

Get the default User-Agent string to use with Guzzle

Returns

string
# public Guzzle\Http\Message\RequestInterface
get( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, array $options = array() )

Create a GET request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$options
array
$options Options to apply to the request. For BC compatibility, you can also pass a string to tell Guzzle to download the body of the response to a particular location. Use the 'body' option instead for forward compatibility.

Returns

Guzzle\Http\Message\RequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::get()
# public Guzzle\Http\Message\RequestInterface
head( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, array $options = array() )

Create a HEAD request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$options
array
$options Options to apply to the request

Returns

Guzzle\Http\Message\RequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::head()
# public EntityEnclosingRequestInterface
delete( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null, array $options = array() )

Create a DELETE request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request
$options
array
$options Options to apply to the request

Returns

EntityEnclosingRequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::delete()
# public EntityEnclosingRequestInterface
put( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null, array $options = array() )

Create a PUT request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request
$options
array
$options Options to apply to the request

Returns

EntityEnclosingRequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::put()
# public EntityEnclosingRequestInterface
patch( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, string|resource|Guzzle\Http\EntityBodyInterface $body = null, array $options = array() )

Create a PATCH request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$body
string|resource|Guzzle\Http\EntityBodyInterface
$body Body to send in the request
$options
array
$options Options to apply to the request

Returns

EntityEnclosingRequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::patch()
# public EntityEnclosingRequestInterface
post( string|array $uri = null, array|Guzzle\Common\Collection $headers = null, array|Guzzle\Common\Collection|string|Guzzle\Http\EntityBodyInterface $postBody = null, array $options = array() )

Create a POST request for the client

Parameters

$uri
string|array
$uri Resource URI
$headers
array|Guzzle\Common\Collection
$headers HTTP headers
$postBody
array|Guzzle\Common\Collection|string|Guzzle\Http\EntityBodyInterface
$postBody POST body. Can be a string, EntityBody, or associative array of POST fields to send in the body of the request. Prefix a value in the array with the @ symbol to reference a file.
$options
array
$options Options to apply to the request

Returns

EntityEnclosingRequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::post()
# public Guzzle\Http\Message\RequestInterface
options( string|array $uri = null, array $options = array() )

Create an OPTIONS request for the client

Parameters

$uri
string|array
$uri Resource URI
$options
array
$options Options to apply to the request

Returns

Guzzle\Http\Message\RequestInterface

See

Guzzle\Http\ClientInterface::createRequest()

Implementation of

Guzzle\Http\ClientInterface::options()
# public Guzzle\Http\Message\Response|array
send( array|Guzzle\Http\Message\RequestInterface $requests )

Sends a single request or an array of requests in parallel

Parameters

$requests
array|Guzzle\Http\Message\RequestInterface
$requests One or more RequestInterface objects to send

Returns

Guzzle\Http\Message\Response|array
Returns a single Response or an array of Response objects

Implementation of

Guzzle\Http\ClientInterface::send()
# public Guzzle\Http\Client
setCurlMulti( Guzzle\Http\Curl\CurlMultiInterface $curlMulti )

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

Parameters

$curlMulti
Guzzle\Http\Curl\CurlMultiInterface
$curlMulti Multi object

Returns

Guzzle\Http\Client
# public Guzzle\Http\Curl\CurlMultiInterface|Guzzle\Http\Curl\CurlMultiProxy
getCurlMulti( )

Returns

Guzzle\Http\Curl\CurlMultiInterface|Guzzle\Http\Curl\CurlMultiProxy
# public
setRequestFactory( Guzzle\Http\Message\RequestFactoryInterface $factory )
# public Guzzle\Http\Client
setUriTemplate( Guzzle\Parser\UriTemplate\UriTemplateInterface $uriTemplate )

Set the URI template expander to use with the client

Parameters

$uriTemplate
Guzzle\Parser\UriTemplate\UriTemplateInterface
$uriTemplate URI template expander

Returns

Guzzle\Http\Client
# protected string
expandTemplate( string $template, array $variables = null )

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

Parameters

$template
string
$template Template to expand
$variables
array
$variables Variables to inject

Returns

string
# protected Guzzle\Parser\UriTemplate\UriTemplateInterface
getUriTemplate( )

Get the URI template expander used by the client

Returns

Guzzle\Parser\UriTemplate\UriTemplateInterface
# protected array
sendMultiple( array $requests )

Send multiple requests in parallel

Parameters

$requests
array
$requests Array of RequestInterface objects

Returns

array
Returns an array of Response objects
# protected Guzzle\Http\Message\RequestInterface
prepareRequest( Guzzle\Http\Message\RequestInterface $request, array $options = array() )

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

Parameters

$request
Guzzle\Http\Message\RequestInterface
$request Request to prepare for the client
$options
array
$options Options to apply to the request

Returns

Guzzle\Http\Message\RequestInterface
# protected
initSsl( )

Initializes SSL settings

# public static string
extractPharCacert( string $pharCacertPath )

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

Parameters

$pharCacertPath
string
$pharCacertPath Path to the phar cacert. For example: 'phar://aws.phar/Guzzle/Http/Resources/cacert.pem'

Returns

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.

Methods inherited from Guzzle\Common\AbstractHasDispatcher

addSubscriber(), dispatch(), getEventDispatcher(), setEventDispatcher()

Magic methods summary

Constants summary

string REQUEST_OPTIONS 'request.options'
#
string CURL_OPTIONS 'curl.options'
#
string SSL_CERT_AUTHORITY 'ssl.certificate_authority'
#
string DISABLE_REDIRECTS Guzzle\Http\RedirectPlugin::DISABLE
#
float DEFAULT_SELECT_TIMEOUT 1.0
#
integer MAX_HANDLES 3
#

Constants inherited from Guzzle\Http\ClientInterface

CREATE_REQUEST, HTTP_DATE

Properties summary

protected Guzzle\Common\Collection $defaultHeaders
#

Default HTTP headers to set on each request

protected string $userAgent
#

The user agent string to set on each request

protected Guzzle\Http\Message\RequestFactoryInterface $requestFactory
#

Request factory used by the client

Properties inherited from Guzzle\Common\AbstractHasDispatcher

$eventDispatcher

AWS SDK for PHP API documentation generated by ApiGen 2.8.0