June 2017
Intermediate to advanced
536 pages
9h 49m
English
The thrift-service/client/ directory is where we will implement our project's client. Let's create a single all-in-one thrift-service/client/index.php file that calls the hello() and goodbye() methods from the Thrift service exposed on http://thrift-service.server/index.php:
<?phprequire_once __DIR__ . '/../vendor/thrift/lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php';use Thrift\ClassLoader\ThriftClassLoader;use Thrift\Transport\THttpClient;use Thrift\Transport\TBufferedTransport;use Thrift\Protocol\TBinaryProtocol;use user\GreetingServiceClient;$loader = new ThriftClassLoader();$loader->registerNamespace('Thrift', __DIR__ . '/../vendor/thrift/lib/php/lib');$loader->registerDefinition('user', __DIR__ . '/../gen-php'); ...Read now
Unlock full access