CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.10 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.10
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class Stream

Implements sending Cake\Http\Client\Request via php's stream API.

This approach and implementation is partly inspired by Aura.Http

Namespace: Cake\Http\Client\Adapter

Property Summary

  • $_connectionErrors protected
    array

    Connection error list.

  • $_context protected
    resource|null

    Context resource used by the stream API.

  • $_contextOptions protected
    array

    Array of options/content for the HTTP stream context.

  • $_sslContextOptions protected
    array

    Array of options/content for the SSL stream context.

  • $_stream protected
    resource|null

    The stream resource.

Method Summary

  • _buildContent() protected

    Builds the request content based on the request object.

  • _buildContext() protected

    Build the stream context out of the request object.

  • _buildHeaders() protected

    Build the header context for the request.

  • _buildOptions() protected

    Build miscellaneous options for the request.

  • _buildResponse() protected

    Build a response object

  • _buildSslContext() protected

    Build SSL options for the request.

  • _open() protected

    Open the socket and handle any connection errors.

  • _send() protected

    Open the stream and send the request.

  • contextOptions() public

    Get the context options

  • createResponses() public

    Create the response list based on the headers & content

  • send() public

    Send a request and get a response back.

Method Detail

_buildContent() ¶ protected

_buildContent(Cake\Http\Client\Request $request, array $options): void

Builds the request content based on the request object.

If the $request->body() is a string, it will be used as is. Array data will be processed with Cake\Http\Client\FormData

Parameters
Cake\Http\Client\Request $request

The request being sent.

array $options

Array of options to use.

Returns
void

_buildContext() ¶ protected

_buildContext(Cake\Http\Client\Request $request, array $options): void

Build the stream context out of the request object.

Parameters
Cake\Http\Client\Request $request

The request to build context from.

array $options

Additional request options.

Returns
void

_buildHeaders() ¶ protected

_buildHeaders(Cake\Http\Client\Request $request, array $options): void

Build the header context for the request.

Creates cookies & headers.

Parameters
Cake\Http\Client\Request $request

The request being sent.

array $options

Array of options to use.

Returns
void

_buildOptions() ¶ protected

_buildOptions(Cake\Http\Client\Request $request, array $options): void

Build miscellaneous options for the request.

Parameters
Cake\Http\Client\Request $request

The request being sent.

array $options

Array of options to use.

Returns
void

_buildResponse() ¶ protected

_buildResponse(array $headers, string $body): Cake\Http\Client\Response

Build a response object

Parameters
array $headers

Unparsed headers.

string $body

The response body.

Returns
Cake\Http\Client\Response

_buildSslContext() ¶ protected

_buildSslContext(Cake\Http\Client\Request $request, array $options): void

Build SSL options for the request.

Parameters
Cake\Http\Client\Request $request

The request being sent.

array $options

Array of options to use.

Returns
void

_open() ¶ protected

_open(string $url): void

Open the socket and handle any connection errors.

Parameters
string $url

The url to connect to.

Returns
void
Throws
Cake\Core\Exception\Exception

_send() ¶ protected

_send(Cake\Http\Client\Request $request): array

Open the stream and send the request.

Parameters
Cake\Http\Client\Request $request

The request object.

Returns
array
Throws
Cake\Http\Exception\HttpException

contextOptions() ¶ public

contextOptions(): array

Get the context options

Useful for debugging and testing context creation.

Returns
array

createResponses() ¶ public

createResponses(array $headers, string $content): Cake\Http\Client\Response[]

Create the response list based on the headers & content

Creates one or many response objects based on the number of redirects that occurred.

Parameters
array $headers

The list of headers from the request(s)

string $content

The response content.

Returns
Cake\Http\Client\Response[]

send() ¶ public

send(Cake\Http\Client\Request $request, array $options): Cake\Http\Client\Response[]

Send a request and get a response back.

Parameters
Cake\Http\Client\Request $request
array $options
Returns
Cake\Http\Client\Response[]

Property Detail

$_connectionErrors ¶ protected

Connection error list.

Type
array

$_context ¶ protected

Context resource used by the stream API.

Type
resource|null

$_contextOptions ¶ protected

Array of options/content for the HTTP stream context.

Type
array

$_sslContextOptions ¶ protected

Array of options/content for the SSL stream context.

Type
array

$_stream ¶ protected

The stream resource.

Type
resource|null
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs