Gdata/App/LoggingHttpClientAdapterSocket.php

Show: inherited
Table of Contents

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 [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Gdata  
Subpackage
App  
Version
$Id: LoggingHttpClientAdapterSocket.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Gdata_App_LoggingHttpClientAdapterSocket

Package: Zend\Gdata\App

Overrides the traditional socket-based adapter class for Zend_Http_Client to enable logging of requests.

All requests are logged to a location specified in the config as $config['logfile']. Requests and responses are logged after they are sent and received/processed, thus an error could prevent logging.

Parent(s)
\Zend_Http_Client_Adapter_Socket
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedresource $_context = null
inherited

Stream context

Inherited from: \Zend_Http_Client_Adapter_Socket::$$_context
Default valuenullDetails
Type
resource
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$_context  
Propertyprotectedarray $config = array('persistent' => false, 'ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false)
inherited

Parameters array

Inherited from: \Zend_Http_Client_Adapter_Socket::$$config
Default valuearray('persistent' => false, 'ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false)Details
Type
array
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$config  
Propertyprotectedarray $connected_to = array(null, null)
inherited

What host/port are we connected to?

Inherited from: \Zend_Http_Client_Adapter_Socket::$$connected_to
Default valuearray(null, null)Details
Type
array
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$connected_to  
Propertyprotectedresource|null $log_handle = null

The file handle for writing logs

Default valuenullDetails
Type
resource | null
Propertyprotectedstring $method = null
inherited

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

Inherited from: \Zend_Http_Client_Adapter_Socket::$$method
Default valuenullDetails
Type
string
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$method  
Propertyprotectedresource $out_stream = null
inherited

Stream for storing output

Inherited from: \Zend_Http_Client_Adapter_Socket::$$out_stream
Default valuenullDetails
Type
resource
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$out_stream  
Propertyprotectedresource|null $socket = null
inherited

The socket for server connection

Inherited from: \Zend_Http_Client_Adapter_Socket::$$socket
Default valuenullDetails
Type
resource | null
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$socket  

Methods

methodpublic__construct() : void
inherited

Adapter constructor, currently empty.

Inherited from: \Zend_Http_Client_Adapter_Socket::__construct()

Config is set using setConfig()

methodpublic__destruct() : void
inherited

Destructor: make sure the socket is disconnected

Inherited from: \Zend_Http_Client_Adapter_Socket::__destruct()

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

methodprotected_checkSocketReadTimeout() : void
inherited

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

Inherited from: \Zend_Http_Client_Adapter_Socket::_checkSocketReadTimeout()
Throws
Exception Description
\Zend_Http_Client_Adapter_Exception with READ_TIMEOUT code
methodpublicclose() : void

Close the connection to the server

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

Connect to the remote server

Parameters
Name Type Description
$host string
$port int
$secure boolean
methodpublicgetConfig() : array
inherited

Retrieve the array of all configuration options

Inherited from: \Zend_Http_Client_Adapter_Socket::getConfig()
Returns
Type Description
array
methodpublicgetStreamContext() : resource
inherited

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

Inherited from: \Zend_Http_Client_Adapter_Socket::getStreamContext()

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

Returns
Type Description
resource
methodprotectedlog(string $message) : void

Log the given message to the log file.

The log file is configured as the config param 'logfile'. This method opens the file for writing if necessary.

Parameters
Name Type Description
$message string

The message to log

methodpublicread() : string

Read response from server

Returns
Type Description
string
methodpublicsetConfig(\Zend_Config $config = array()) : void
inherited

Set the configuration array for the adapter

Inherited from: \Zend_Http_Client_Adapter_Socket::setConfig()
Parameters
Name Type Description
$config \Zend_Config

| array $config

methodpublicsetOutputStream(resource $stream) : \Zend_Http_Client_Adapter_Socket
inherited

Set output stream for the response

Inherited from: \Zend_Http_Client_Adapter_Socket::setOutputStream()

This function sets output stream where the result will be stored.

Parameters
Name Type Description
$stream resource
Returns
Type Description
\Zend_Http_Client_Adapter_Socket
methodpublicsetStreamContext(mixed $context) : \Zend_Http_Client_Adapter_Socket
inherited

Set the stream context for the TCP connection to the server

Inherited from: \Zend_Http_Client_Adapter_Socket::setStreamContext()

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.

Parameters
Name Type Description
$context mixed

Stream context or array of context options

Returns
Type Description
\Zend_Http_Client_Adapter_Socket
Details
Since
Zend Framework 1.9  
methodpublicwrite(string $method, \Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = array(), string $body = '') : string

Send request to the remote server

Parameters
Name Type Description
$method string
$uri \Zend_Uri_Http
$http_ver string
$headers array
$body string
Returns
Type Description
string Request as string
Documentation was generated by phpDocumentor 2.0.0a8.