diff options
Diffstat (limited to 'examples/php/greeter_client.php')
-rw-r--r-- | examples/php/greeter_client.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/php/greeter_client.php b/examples/php/greeter_client.php index 718ef88c64..a5c0865393 100644 --- a/examples/php/greeter_client.php +++ b/examples/php/greeter_client.php @@ -32,19 +32,21 @@ * */ -require dirname(__FILE__) . '/vendor/autoload.php'; -require dirname(__FILE__) . '/helloworld.php'; +require dirname(__FILE__).'/vendor/autoload.php'; +require dirname(__FILE__).'/helloworld.php'; -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; +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; } $name = !empty($argv[1]) ? $argv[1] : 'world'; -print(greet($name)."\n"); +echo greet($name)."\n"; |