Microsoft_Http
[ class tree: Microsoft_Http ] [ index: Microsoft_Http ] [ all elements ]

Class: Microsoft_Http_Client_Adapter_Socket

Source Location: /Http/Client/Adapter/Socket.php

Class Overview


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


Author(s):

Copyright:

  • Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)

Implements interfaces:

Variables

Methods


Child classes:

Microsoft_Http_Client_Adapter_Proxy
HTTP Proxy-supporting Microsoft_Http_Client adapter class, based on the default socket based adapter.

Class Details

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



Tags:

copyright:  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
license:  New BSD License


[ Top ]


Class Variables

$config = array(
        'persistent'    => false,
        'ssltransport'  => 'ssl',
        'sslcert'       => null,
        'sslpassphrase' => null
    )

[line 67]

Parameters array



Tags:

access:  protected

Type:   array


[ Top ]

$connected_to = array(null, null)

[line 53]

What host/port are we connected to?



Tags:

access:  protected

Type:   array


[ Top ]

$method =  null

[line 79]

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



Tags:

access:  protected

Type:   string


[ Top ]

$out_stream =  null

[line 60]

Stream for storing output



Tags:

access:  protected

Type:   resource


[ Top ]

$socket =  null

[line 46]

The socket for server connection



Tags:

access:  protected

Type:   resource|null


[ Top ]

$_context =  null

[line 86]

Stream context



Tags:

access:  protected

Type:   resource


[ Top ]



Class Methods


constructor __construct [line 92]

Microsoft_Http_Client_Adapter_Socket __construct( )

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



Tags:

access:  public


[ Top ]

destructor __destruct [line 517]

void __destruct( )

Destructor: make sure the socket is disconnected

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




Tags:

access:  public


Overridden in child classes as:

Microsoft_Http_Client_Adapter_Proxy::__destruct()
Destructor: make sure the socket is disconnected

[ Top ]

method close [line 470]

void close( )

Close the connection to the server



Tags:

access:  public


Overridden in child classes as:

Microsoft_Http_Client_Adapter_Proxy::close()
Close the connection to the server


Implementation of:
Microsoft_Http_Client_Adapter_Interface::close()
Close the connection to the server
[ Top ]

method connect [line 180]

void connect( string $host, [int $port = 80], [boolean $secure = false])

Connect to the remote server



Tags:

access:  public


Overridden in child classes as:

Microsoft_Http_Client_Adapter_Proxy::connect()
Connect to the remote server


Implementation of:
Microsoft_Http_Client_Adapter_Interface::connect()
Connect to the remote server

Parameters:

string   $host  
int   $port  
boolean   $secure  

[ Top ]

method getConfig [line 120]

array getConfig( )

Retrieve the array of all configuration options



Tags:

access:  public


[ Top ]

method getStreamContext [line 164]

resource getStreamContext( )

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

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




Tags:

access:  public


[ Top ]

method read [line 303]

string read( )

Read response from server



Tags:

access:  public



Implementation of:
Microsoft_Http_Client_Adapter_Interface::read()
Read response from server
[ Top ]

method setConfig [line 101]

void setConfig( [array $config = array()])

Set the configuration array for the adapter



Tags:

access:  public



Implementation of:
Microsoft_Http_Client_Adapter_Interface::setConfig()
Set the configuration array for the adapter

Parameters:

array   $config  

[ Top ]

method setOutputStream [line 505]

Microsoft_Http_Client_Adapter_Socket setOutputStream( resource $stream)

Set output stream for the response



Tags:

access:  public



Implementation of:
Microsoft_Http_Client_Adapter_Stream::setOutputStream()
Set output stream

Parameters:

resource   $stream  

[ Top ]

method setStreamContext [line 138]

Microsoft_Http_Client_Adapter_Socket setStreamContext( mixed $context)

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.




Tags:

since:  Zend Framework 1.9
access:  public


Parameters:

mixed   $context   Stream context or array of context options

[ Top ]

method write [line 248]

string write( string $method, Microsoft_Uri_Http $uri, [string $http_ver = '1.1'], [array $headers = array()], [string $body = ''])

Send request to the remote server



Tags:

return:  Request as string
access:  public


Overridden in child classes as:

Microsoft_Http_Client_Adapter_Proxy::write()
Send request to the proxy server


Implementation of:
Microsoft_Http_Client_Adapter_Interface::write()
Send request to the remote server

Parameters:

string   $method  
Microsoft_Uri_Http   $uri  
string   $http_ver  
array   $headers  
string   $body  

[ Top ]

method _checkSocketReadTimeout [line 483]

void _checkSocketReadTimeout( )

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



Tags:

throws:  Microsoft_Http_Client_Adapter_Exception with READ_TIMEOUT code
access:  protected


[ Top ]


Documentation generated on Wed, 18 May 2011 12:06:52 +0200 by phpDocumentor 1.4.3