Created
December 31, 2019 03:27
-
-
Save gistlyn/601b972a4e48322b7ecceebc461e65e4 to your computer and use it in GitHub Desktop.
PHP Google protoc insecure GrpcServicesClient TodoWorld Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require dirname(__FILE__).'/vendor/autoload.php'; | |
@include_once dirname(__FILE__).'/GPBMetadata/Services.php'; | |
@include_once dirname(__FILE__).'/TodoWorld/GrpcServicesClient.php'; | |
@include_once dirname(__FILE__).'/TodoWorld/Hello.php'; | |
@include_once dirname(__FILE__).'/TodoWorld/HelloResponse.php'; | |
$client = new TodoWorld\GrpcServicesClient('todoworld.servicestack.net:5054', [ | |
'credentials' => Grpc\ChannelCredentials::createInsecure(), | |
]); | |
$request = new TodoWorld\Hello(); | |
$request->setName("gRPC PHP"); | |
list($reply, $status) = $client->GetHello($request)->wait(); | |
if ($status->code !== Grpc\STATUS_OK) { | |
echo "Call did not complete successfully. Status object:\n"; | |
var_dump($status); | |
exit(1); | |
} | |
echo $reply->getResult(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment