[英]PHP based thrift API client like thirft.apache.org example client in python
我想在python中编写基于PHP的thrift API客户端,例如thirft.apache.org示例客户端: 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客户端代码的正确替代品: http : //thrift.apache.org/
因为我是新手,请给出任何建议。
谢谢
在Thrift Usage页面查看Thrift Wiki 。 这在许多支持的语言中有例子,特别是在PHP中有一个示例客户端 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.