Yar_Client::setOpt

(PECL yar >= 1.0.0)

Yar_Client::setOptSet calling contexts

Açıklama

public Yar_Client::setOpt(int $name, mixed $value): Yar_Client|false

Bağımsız Değişkenler

name

it can be: YAR_OPT_PACKAGER, YAR_OPT_PERSISTENT (Need server support), YAR_OPT_TIMEOUT, YAR_OPT_CONNECT_TIMEOUT, YAR_OPT_HEADER (as of 2.0.4), YAR_OPT_PROXY (as of 2.2.0)

value

Dönen Değerler

Returns $this on success başarısızlık durumunda false döner.

Örnekler

Örnek 1 Yar_Client::setOpt() example

<?php

$cient
= new Yar_Client("http://host/api/");

//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"));

// Set Http Proxy
$client->SetOpt(YAR_OPT_PROXY, "127.0.0.1:8888");

/* call remote service */
$result = $client->some_method("parameter");
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:


Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top