简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM