PHP Класс 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.
См. также: lithium\net\socket\Stream
Наследование: extends lithium\net\Socket
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( array $config = [] ) : void
$config array
Результат void

close() публичный Метод

Closes the curl connection.
public close ( ) : boolean
Результат boolean True on closed connection

encoding() публичный Метод

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

eof() публичный Метод

EOF is unimplemented for this socket adapter.
public eof ( ) : null
Результат null

open() публичный Метод

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()
Результат 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() публичный Метод

The read method will utilize the curl options that have been set.
public read ( ) : mixed
Результат mixed Boolean false if the resource handle is unavailable, and the result of `curl_exec` otherwise.

set() публичный Метод

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.
Результат void

timeout() публичный Метод

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
Результат boolean False if the resource handle is unavailable or the option could not be set, true otherwise.

write() публичный Метод

Writes data to curl options
public write ( array | Message $data = null ) : boolean
$data array | lithium\net\Message
Результат boolean

Описание свойств

$options публичное свойство

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.
См. также: lithium\net\socket\Curl::set()
public array $options
Результат array