XML-RPC(PHP) Client Demo
setDebug(1); // デバッグモードを有効にする場合はアンコメント
//メッセージ作成
$message = new xmlrpcmsg(
'weblogUpdates.ping', // pingメソッドの選択
// 'weblogUpdates.extendedPing', // pingメソッドの選択
array(
new xmlrpcval('your weblog title'), // ブログのタイトル
new xmlrpcval('http://your.nucleus.url/path/'), // ブログのURL
// new xmlrpcval('http://your.nucleus.url/path/to/contents/'), // 変更があったコンテンツのURL(空白でも可)
// new xmlrpcval('http://your.nucleus.url/path/to/feed.xml'), // RSSやAtom等のURL
)
);
/******* メソッドに weblogUpdates.extendedPing を指定した場合は、3、4番目が必須になります ******/
//メッセージ送信
$response = $c->send($message);
// Process the response.
if (!$response->faultCode()) {
$struct = $response->value();
$resultval = $struct->structmem('message');
echo "Value: ".$resultval->scalarval();
echo "The XML received:" . htmlspecialchars($response->serialize());
echo "
";
}else{
echo "Fault Code: " . $response->faultCode() . "
";
echo "Fault Reason: " . $response->faultString() . "
";
echo "The XML received:" . htmlspecialchars($response->serialize());
echo "
";
}
?>