PHP Australia Conference 2015


(PECL pecl_http >= 0.10.0)

HttpRequest::setOptionsSet options


public bool HttpRequest::setOptions ([ array $options ] )

Set the request options to use.

See the full list of request options.



an associative array, which values will overwrite the currently set request options; if empty or omitted, the options of the HttpRequest object will be reset

Return Values

Returns TRUE on success or FALSE on failure.

add a note add a note

User Contributed Notes 1 note

mightye at gmail dot com
7 years ago
Note that options cannot be changed on a request once it is added to a HttpRequestPool.  The pool reads the options and uses the values as they were set at the time it was added.

This means you can't do things like dynamically change the timeout each time you receive some data from the stream (essentially creating an idle timeout when doing things like calling remote long-running jobs).  However you can use low_speed_limit and low_speed_time options to simulate this behavior.
To Top