Search code examples
phppythonthriftthrift-protocol

PHP based thrift API client like thirft.apache.org example client in python


I want to write PHP based thrift API client like thirft.apache.org example client in python at: http://thrift.apache.org/

I write this code:

      //A struture
      $up = UserProfile($uid=1,
             $name="Mark Slee",
             $blurb="I'll find something to put here.");

      # Talk to a server via TCP sockets, using a binary protocol
      $fp = fsockopen("localhost",9090, $errno, $errstr, 90);
      # Use the service we already defined
      $service=fwrite($fp, $up);

      while (!feof($fp)) {
          echo fgets($fp, 128);
      }

so is it correct alternative of python client code at : http://thrift.apache.org/

Please give any suggestion as I am new to it.

thanks


Solution

  • Look in the Thrift Wiki at the Thrift Usage page. That has examples in many supported languages, in particular, there's an example client in PHP.