PHP Class lithium\net\socket\Curl

This curl adapter provides the required method implementations of the abstract Socket class for open, close, read, write, timeout eof and encoding. Your PHP installation must have been compiled with the --with-curl[=DIR] directive. If this is not the case, you must either recompile PHP with the proper configuration flags to enable curl, or you may use the Stream adapter that is also included with the Lithium core.
See also: lithium\net\socket\Stream
Inheritance: extends lithium\net\Socket
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Méthodes publiques

Свойство Type Description
$options array Contains options that will be passed to curl_setopt_array before read and write operations. These options should be set by using the set method.

Méthodes publiques

Méthode Description
__construct ( array $config = [] ) : void Constructor.
close ( ) : boolean Closes the curl connection.
encoding ( string $charset ) encoding() is currently unimplemented for this socket adapter
eof ( ) : null EOF is unimplemented for this socket adapter.
open ( array $options = [] ) : mixed Opens a curl connection and initializes the internal resource handle.
read ( ) : mixed Reads data from the curl connection.
set ( array $flags, array $value = null ) : void Sets the options to be used in subsequent curl requests.
timeout ( integer $time ) : boolean A convenience method to set the curl CURLOPT_CONNECTTIMEOUT setting for the current connection. This determines the number of seconds to wait while trying to connect.
write ( array | Message $data = null ) : boolean Writes data to curl options

Method Details

__construct() public méthode

Constructor.
public __construct ( array $config = [] ) : void
$config array
Résultat void

close() public méthode

Closes the curl connection.
public close ( ) : boolean
Résultat boolean True on closed connection

encoding() public méthode

encoding() is currently unimplemented for this socket adapter
public encoding ( string $charset )
$charset string

eof() public méthode

EOF is unimplemented for this socket adapter.
public eof ( ) : null
Résultat null

open() public méthode

Opens a curl connection and initializes the internal resource handle.
public open ( array $options = [] ) : mixed
$options array update the config settings if $options['options'] exists, will be passed to $this->set()
Résultat mixed Returns `false` if the socket configuration does not contain the `'scheme'` or `'host'` settings, or if configuration fails, otherwise returns a resource stream.

read() public méthode

The read method will utilize the curl options that have been set.
public read ( ) : mixed
Résultat mixed Boolean false if the resource handle is unavailable, and the result of `curl_exec` otherwise.

set() public méthode

Sets the options to be used in subsequent curl requests.
public set ( array $flags, array $value = null ) : void
$flags array If $values is an array, $flags will be used as the keys to an associative array of curl options. If $values is not set, then $flags will be used as the associative array.
$value array If set, this array becomes the values for the associative array of curl options.
Résultat void

timeout() public méthode

Note: A value of 0 may be used to specify an indefinite wait time.
public timeout ( integer $time ) : boolean
$time integer The timeout value in seconds
Résultat boolean False if the resource handle is unavailable or the option could not be set, true otherwise.

write() public méthode

Writes data to curl options
public write ( array | Message $data = null ) : boolean
$data array | lithium\net\Message
Résultat boolean

Property Details

$options public_oe property

Contains options that will be passed to curl_setopt_array before read and write operations. These options should be set by using the set method.
See also: lithium\net\socket\Curl::set()
public array $options
Résultat array