基于PHP的thrift API客户端,类似thirft.apache.org的Python示例客户端
我想写一个基于PHP的thrift API客户端,类似于在这个网站上用Python写的示例客户端:http://thrift.apache.org/
我写了以下代码:
//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);
}
那么这段代码是否可以作为Python客户端代码的正确替代呢?在这里可以查看Python的示例:http://thrift.apache.org/
因为我对这个还很陌生,所以请给我一些建议。
谢谢!