| 
					
				 | 
			
			
				@@ -17,24 +17,28 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// php:generate protoc --proto_path=./../protos   --php_out=./   --grpc_out=./ --plugin=protoc-gen-grpc=./../../bins/opt/grpc_php_plugin ./../protos/helloworld.proto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// To generate the necessary proto classes: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// $ protoc --proto_path=../protos --php_out=. --grpc_out=. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//   --plugin=protoc-gen-grpc=../../bins/opt/grpc_php_plugin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//   ../protos/helloworld.proto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 require dirname(__FILE__).'/vendor/autoload.php'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-function greet($name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function greet($hostname, $name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $client = new Helloworld\GreeterClient('localhost:50051', [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $client = new Helloworld\GreeterClient($hostname, [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'credentials' => Grpc\ChannelCredentials::createInsecure(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $request = new Helloworld\HelloRequest(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $request->setName($name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    list($reply, $status) = $client->SayHello($request)->wait(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    list($response, $status) = $client->SayHello($request)->wait(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if ($status->code !== Grpc\STATUS_OK) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        echo "ERROR: ".$status->code.", ".$status->details."\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        echo "ERROR: " . $status->code . ", " . $status->details . PHP_EOL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         exit(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    echo $reply->getMessage()."\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    echo $response->getMessage() . PHP_EOL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $name = !empty($argv[1]) ? $argv[1] : 'world'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-greet($name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+$hostname = !empty($argv[2]) ? $argv[2] : 'localhost:50051'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+greet($hostname, $name); 
			 |