# pear install XML_RPC
<html> <head> <title>XML-RPC(PHP) Client Demo</title> </head> <body> <h1>XML-RPC(PHP) Client Demo</h1> <?php require_once("XML/RPC.php"); $GLOBALS['XML_RPC_defencoding'] = "UTF-8"; //クライアントの作成 $xmlrpc_host = "https://svn.example.com"; $xmlrpc_path = "/projects/officialsite/xmlrpc"; $c = new XML_RPC_client( $xmlrpc_path, $xmlrpc_host); $c->setCredentials("ユーザ名", "パスワード"); //メッセージ作成 //$params = array(new XML_RPC_Value( 5, 'int' ) // ,new XML_RPC_Value( 3, 'int' )); $params = array(); $message = new XML_RPC_Message('system.getAPIVersion',$params); //メッセージ送信 $response = $c->send($message); // Process the response. if (!$response->faultCode()) { $v = $response->value(); print "Value: ". $v->scalarval() ."<br>"; print "The XML received:<blockquote>" . $response->serialize(); print "</blockquote>"; }else{ print "Fault Code: " . $response->faultCode() . "<br>"; print "Fault Reason: " . $response->faultString() . "<br>"; } ?> </body> </html>
PukiWiki 1.5.3 © 2001-2020 PukiWiki Development Team. Powered by PHP 7.4.33. HTML convert time: 0.141 sec.