CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 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

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Curl
  • Stream

Class Stream

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

This approach and implementation is partly inspired by Aura.Http

Cake\Http\Client\Adapter\Stream implements Cake\Http\Client\AdapterInterface
Namespace: Cake\Http\Client\Adapter
Location: Http/Client/Adapter/Stream.php

Properties 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 )

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.

_buildContext() protected ¶

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

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.

_buildHeaders() protected ¶

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

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.

_buildOptions() protected ¶

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

Build miscellaneous options for the request.

Parameters
Cake\Http\Client\Request $request
The request being sent.
array $options
Array of options to use.

_buildResponse() protected ¶

_buildResponse( array $headers , string $body )

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 )

Build SSL options for the request.

Parameters
Cake\Http\Client\Request $request
The request being sent.
array $options
Array of options to use.

_open() protected ¶

_open( string $url )

Open the socket and handle any connection errors.

Parameters
string $url
The url to connect to.
Throws
Cake\Core\Exception\Exception

_send() protected ¶

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

Open the stream and send the request.

Parameters
Cake\Http\Client\Request $request
The request object.
Returns
array
Array of populated Response objects
Throws
Cake\Http\Exception\HttpException

contextOptions() public ¶

contextOptions( )

Get the context options

Useful for debugging and testing context creation.

Returns
array

createResponses() public ¶

createResponses( array $headers , string $content )

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[]
The list of responses from the request(s)

send() public ¶

send( Cake\Http\Client\Request $request , array $options )

Send a request and get a response back.

Parameters
Cake\Http\Client\Request $request
The request object to send.
array $options
Array of options for the stream.
Returns
Cake\Http\Client\Response[]
Array of populated Response objects
Implementation of
Cake\Http\Client\AdapterInterface::send()

Properties detail

$_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.

Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs