API Documentation

Http/Client/Adapter/Socket.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
subpackage
Client_Adapter
version
$Id: Socket.php 23775 2011-03-01 17:25:24Z ralph $
Classes
Zend_Http_Client_Adapter_Socket

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Http_Client_Adapter_Socket

Implements
Zend_Http_Client_Adapter_Interface
Zend_Http_Client_Adapter_Stream
category
Zend
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
subpackage
Client_Adapter
Properties
$socket
$connected_to
$out_stream
$config
$method
$_context
Methods
__construct
setConfig
getConfig
setStreamContext
getStreamContext
connect
write
read
close
_checkSocketReadTimeout
setOutputStream
__destruct

Description

A sockets based (stream_socket_client) adapter class for Zend_Http_Client. Can be used on almost every PHP environment, and does not require any special extensions.

Properties

$_context

resource $_context = 'null'

Stream context

Details

$_context
resource
visibility
protected
default
null
final
false
static
false

$config

array $config = 'array'

Parameters array

Details

$config
array
visibility
protected
default
array
final
false
static
false

$connected_to

array $connected_to = 'array'

What host/port are we connected to?

Details

$connected_to
array
visibility
protected
default
array
final
false
static
false

$method

string $method = 'null'

Request method - will be set by write() and might be used by read()

Details

$method
string
visibility
protected
default
null
final
false
static
false

$out_stream

resource $out_stream = 'null'

Stream for storing output

Details

$out_stream
resource
visibility
protected
default
null
final
false
static
false

$socket

resource|null $socket = 'null'

The socket for server connection

Details

$socket
resource|null
visibility
protected
default
null
final
false
static
false

Methods

__construct

__construct( ) :

Adapter constructor, currently empty. Config is set using setConfig()

Details
visibility
public
final
false
static
false

__destruct

__destruct( ) :

Destructor: make sure the socket is disconnected

If we are in persistent TCP mode, will not close the connection

Details
visibility
public
final
false
static
false

_checkSocketReadTimeout

_checkSocketReadTimeout( ) :

Check if the socket has timed out - if so close connection and throw an exception

Details
visibility
protected
final
false
static
false
throws
with READ_TIMEOUT code

close

close( ) :

Close the connection to the server

Details
visibility
public
final
false
static
false

connect

connect( string $host, int $port = 80, boolean $secure = false ) :

Connect to the remote server

Arguments
$host
string
$port
int
$secure
boolean
Details
visibility
public
final
false
static
false

getConfig

getConfig( ) : array

Retrieve the array of all configuration options

Output
array
Details
visibility
public
final
false
static
false

getStreamContext

getStreamContext( ) : resource

Get the stream context for the TCP connection to the server.

If no stream context is set, will create a default one.

Output
resource
Details
visibility
public
final
false
static
false

read

read( ) : string

Read response from server

Output
string
Details
visibility
public
final
false
static
false

setConfig

setConfig( Zend_Config $config = array ) :

Set the configuration array for the adapter

Arguments
$config
Zend_Config
| array $config
Details
visibility
public
final
false
static
false

setOutputStream

setOutputStream( resource $stream ) : Zend_Http_Client_Adapter_Socket

Set output stream for the response

Arguments
$stream
resource
Details
visibility
public
final
false
static
false

setStreamContext

setStreamContext( mixed $context ) : Zend_Http_Client_Adapter_Socket

Set the stream context for the TCP connection to the server

Can accept either a pre-existing stream context resource, or an array of stream options, similar to the options array passed to the stream_context_create() PHP function. In such case a new stream context will be created using the passed options.

Arguments
$context
mixed
Stream context or array of context options
Details
visibility
public
final
false
static
false
since
Zend Framework 1.9

write

write( string $method, Zend_Uri_Http $uri, string $http_ver = 1.1, array $headers = array, string $body ) : string

Send request to the remote server

Arguments
$method
string
$uri
Zend_Uri_Http
$http_ver
string
$headers
array
$body
string
Output
string
Request as string
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.