3 <title>XML-RPC(PHP) Client Demo</title>
6 <h1>XML-RPC(PHP) Client Demo</h1>
10 include_once("./config.php"); // include Nucleus libs and code
11 include_once($DIR_LIBS . "xmlrpc.inc.php");
12 $xmlrpc_internalencoding = _CHARSET;
13 $xmlrpc_defencoding = 'UTF-8';
16 $xmlrpc_host = "your host name"; // Nucleus を設置しているサーバのホスト名
17 $xmlrpc_path = "/?action=plugin&name=UodatePingServer&type=updateping"; // pingサーバスクリプトのパス
18 // $xmlrpc_path = "/RPCS"; // .htaccess を設定している時はこっち
19 $c = new xmlrpc_client( $xmlrpc_path, $xmlrpc_host, 80 );
20 // $c->setDebug(1); // デバッグモードを有効にする場合はアンコメント
23 $message = new xmlrpcmsg(
24 'weblogUpdates.ping', // pingメソッドの選択
25 // 'weblogUpdates.extendedPing', // pingメソッドの選択
27 new xmlrpcval('your weblog title'), // ブログのタイトル
28 new xmlrpcval('http://your.nucleus.url/path/'), // ブログのURL
29 // new xmlrpcval('http://your.nucleus.url/path/to/contents/'), // 変更があったコンテンツのURL(空白でも可)
30 // new xmlrpcval('http://your.nucleus.url/path/to/feed.xml'), // RSSやAtom等のURL
33 /******* メソッドに weblogUpdates.extendedPing を指定した場合は、3、4番目が必須になります ******/
36 $response = $c->send($message);
38 // Process the response.
39 if (!$response->faultCode()) {
40 $struct = $response->value();
41 $resultval = $struct->structmem('message');
42 echo "Value: ".$resultval->scalarval();
43 echo "The XML received:<pre>" . htmlspecialchars($response->serialize());
47 echo "Fault Code: " . $response->faultCode() . "<br>";
48 echo "Fault Reason: " . $response->faultString() . "<br>";
49 echo "The XML received:<pre>" . htmlspecialchars($response->serialize());