PHP的XML-RPC協議封裝:Simple XMLRPC

jopen 12年前發布 | 70K 次閱讀 XML-RPC XML-RPC 開發

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);

?> 

項目主頁:http://www.baiduhome.net/lib/view/home/1347781434505

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!