Yar_Client::__construct
(PECL yar >= 1.0.0)
Create a client
Description
Creates a Yar_Client for the RPC service located at uri.
Parameters
uriAddress of the RPC service. The protocol is derived from the scheme:
http://andhttps://select the HTTP transport,tcp://selects the TCP transport, andunix://selects the Unix socket transport.optionsAn Array of client options, keyed by the
YAR_OPT_*constants, equivalent to callingYar_Client::setOptfor each entry. Invalid options are silently skipped.
Return Values
A new Yar_Client instance.
Errors/Exceptions
If the URI does not start with a supported scheme, a Yar_Client_Protocol_Exception is thrown.
Examples
Yar_Client::__construct example
<?php
$client = new Yar_Client("http://api.example.com/operator.php");
/* with options */
$client = new Yar_Client("http://api.example.com/operator.php", [
YAR_OPT_TIMEOUT => 1000,
YAR_OPT_PACKAGER => "json",
]);
?>See Also
Yar_Client::callYar_Client::setOpt