誰かがXML-RPCを助けてくれますか? 私はライブラリxmlrpcを使用していますhttp://gggeek.github.io/phpxmlrpc/バージョン4.0.0PHP - XML RPCエラー
getDataとその結果を呼び出す方法がわかりません。 私はいつもエラーを返すよ17
ありがとうございました!
これは私の「サーバー」クラスです。
class xmlrpc_server (
public function run(){
$this->getMethods();
$this->server = new PhpXmlRpc\Server($this->methods);
}
public function getMethods(){
$this->methods = array(
"getData" => array(
"function" => "getData",
"signature" => array(array(PhpXmlRpc\Value::$xmlrpcArray, PhpXmlRpc\Value::$xmlrpcInt )),
"docstring" => "Auth server - getData (with AUTH ID)."
)
);
}
function getData($m){
$mydata = array();
$mydata['user_id'] = $m->getParam(0); //sended user ID
return PhpXmlRpc\Response($myexport, "array");
}
}
Clientクラス
class client(
public function send(){
$this->user_id = 123456;
PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
$this->server_connect = new xmlrpc_client('/index.php', 'myserver.com', 80);
$params = array(new xmlrpcval($this->user_id, 'int'));
$msg = new xmlrpcmsg('getData', $params); //call 'getData'
$response = $this->server_connect->send($msg); //send and get response
print_r($response); //print response
}
)
$client = new client;
$client->send();
としますprint_rの結果()
PhpXmlRpc\Response Object
(
[val] => 0
[valtyp] =>
[errno] => 17
[errstr] => Internal server error: no function matches method
[payload] =>
[hdrs] => Array
(
[date] => Sat, 11 Feb 2017 13:57:40 GMT
[server] => Apache/2.4.10 (Debian)
[vary] => Accept-Charset,Accept-Encoding
[content-encoding] => gzip
[content-length] => 201
[connection] => close
[content-type] => text/xml; charset=UTF-8
)
[_cookies] => Array
(
)
[content_type] => text/xml
[raw_data] => HTTP/1.1 200 OK
Date: Sat, 11 Feb 2017 13:57:40 GMT
Server: Apache/2.4.10 (Debian)
Vary: Accept-Charset,Accept-Encoding
Content-Encoding: gzip
Content-Length: 201
Connection: close
Content-Type: text/xml; charset=UTF-8