PHP Thrift client

Directory structure

PHP config

PHP code

<?php
$GLOBALS['THRIFT_ROOT'] = 'thrift';

require_once 'thrift/Thrift.php';
require_once 'thrift/transport/TTransport.php';
require_once 'thrift/transport/TSocket.php';
require_once 'thrift/protocol/TBinaryProtocol.php';
require_once 'thrift/transport/TFramedTransport.php';
require_once 'thrift/transport/TBufferedTransport.php';

require_once 'thrift/packages/MyService/MyService.php';
require_once 'thrift/packages/MyService/MyService_types.php';

$transport = new TSocket('localhost', 7911);
$transport->open();

$protocol = new TBinaryProtocol($transport);

$client= new MyServiceClient($protocol, $protocol);

$result = $client->operation('param1', 'param2');

Print 'result = ' . $result;

$transport->close();
?>

PHP Notes

 $this->success[$elem40] = true; It says "illegal offset type"