コード例 #1
0
ファイル: greeter_client.php プロジェクト: Crusty82/grpc
function greet($name)
{
    $client = new helloworld\GreeterClient('localhost:50051', []);
    $request = new helloworld\HelloRequest();
    $request->setName($name);
    list($reply, $status) = $client->SayHello($request)->wait();
    $message = $reply->getMessage();
    return $message;
}
コード例 #2
0
ファイル: greeter_client.php プロジェクト: goldenbull/grpc
function greet($name)
{
    $client = new helloworld\GreeterClient('localhost:50051', ['credentials' => Grpc\ChannelCredentials::createInsecure()]);
    $request = new helloworld\HelloRequest();
    $request->setName($name);
    list($reply, $status) = $client->SayHello($request)->wait();
    $message = $reply->getMessage();
    return $message;
}
コード例 #3
0
<?php

//phpinfo();
require __DIR__ . '/../grpc/examples/php/vendor/autoload.php';
require __DIR__ . '/../helloworld.php';
$client = new helloworld\GreeterClient('0.0.0.0:50051', []);
$req = new helloworld\HelloRequest();
$req->setName('Daniel');
list($reply, $status) = $client->SayHello($req)->wait();
echo "<pre>" . $reply->getMessage() . "</pre>";
?>