Php/docs/yar-client.setopt
From Get docs
Yar_Client::setOpt
(PECL yar >= 1.0.0)
Yar_Client::setOpt — Set calling contexts
Description
public Yar_Client::setOpt
( int $name
, mixed $value
) : Yar_Client|false
Parameters
name
- it can be: YAR_OPT_PACKAGER, YAR_OPT_PERSISTENT (Need server support), YAR_OPT_TIMEOUT, YAR_OPT_CONNECT_TIMEOUT YAR_OPT_HEADER (Since 2.0.4)
value
Return Values
Returns $this
on success or FALSE
on failure.
Examples
Example #1 Yar_Client::setOpt() example
<?php$cient = new Yar_Client("http://host/api/%22);//Set timeout to 1s$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);//Set packager to JSON$client->SetOpt(YAR_OPT_PACKAGER, "json");//Set Custom headers$client->SetOpt(YAR_OPT_HEADER, array("hr1: val1", "hd2: val2"));/* call remote service */$result = $client->some_method("parameter");?>
The above example will output something similar to: