PHP的XML-RPC协议封装:Simple XMLRPC
Simple XMLRPC 是 一个 PHP 语言对 XML-RPC 协议的封装。下面是一个使用示例:
<?php require_once ('simpleXMLRPCClient.class.php'); $server_path = '/simplexmlrpc/index.php'; $server_hostname = 'localhost'; $sendHTTPS = 0; $serverPort = NULL; $xmlrpc = new SimpleXMLRPCClient (); $xmlrpc->debug = 0; $xmlrpc->SetXMLRPCServer ($server_hostname, $server_path, $serverPort, $sendHTTPS); # Array that we want to send $arrayOfStructs = Array ( Array ('curly' => 3), Array ('curly' => 2) ); # Create the XMLRPC message with the methodName $xmlrpc->CreateXMLRPCMessage ('validator1.arrayOfStructsTest'); # Now we simply add the array we want to send with the message $xmlrpc->AddArray ($arrayOfStructs); # And now we send it and we get back an array $array = $xmlrpc->SendXMLRPC (); # print out the returned array print_r ($array); ?>
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!