Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Thrift Wiki" for change 
notification.

The "ThriftUsagePhp" page has been changed by DavidEhrmann.
http://wiki.apache.org/thrift/ThriftUsagePhp

--------------------------------------------------

New page:
= PHP Thrift client =

== Directory structure ==
  * <php library root>
    * thrift
      * packages
        * <contents of php_gen>
      * protocol
        * TBinaryProtocol.php
        * TProtocol.php
      * transport
        * TBufferedTransport.php
        * TFramedTransport.php
        * THttpClient.php
        * TMemoryBuffer.php
        * TNullTransport.php
        * TPhpStream.php
        * TSocket.php
        * TSocketPool.php
        * TTransport.php
      * autoload.php
      * Thrift.php

== PHP config ==
  * Add <php library root> to include_path.

== 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();
?>
}}}

Reply via email to