WEBサービス・API/Seesaaブログ/XML-RPC
リンク
-Seesaaブログ
–http://blog.seesaa.jp/
-ドキュメント
–どこ?
手順
サポートされているメソッドの一覧(mt.suportedMethods)
require_once "XML/RPC.php";
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"mt.supportedMethods",
array()
);
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"mt.supportedMethods",
array()
);
$client = new XML_RPC_client("/rpc", "blog.seesaa.jp", 80);
$response = $client->send($message);
print_r($response);
ユーザー追加(seesaa.newUser)
require_once "XML/RPC.php";
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.newUser",
array(
new XML_RPC_Value(array(
"email"=> new XML_RPC_Value($email, "string"),
"password"=> new XML_RPC_Value($password, "string"),
"name"=> new XML_RPC_Value($user, "string"),
"name_read"=> new XML_RPC_Value($userKana, "string"),
), "struct")
)
);
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.newUser",
array(
new XML_RPC_Value(array(
"email"=> new XML_RPC_Value($email, "string"),
"password"=> new XML_RPC_Value($password, "string"),
"name"=> new XML_RPC_Value($user, "string"),
"name_read"=> new XML_RPC_Value($userKana, "string"),
), "struct")
)
);
$client = new XML_RPC_client("/rpc", "blog.seesaa.jp", 80);
$response = $client->send($message);
print_r($response);
Captcha画像の取得(seesaa.getCaptcha)
ブログの開設時に必要
require_once "XML/RPC.php";
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.getCaptcha",
array(
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string")
)
);
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.getCaptcha",
array(
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string")
)
);
$client = new XML_RPC_client("/rpc", "blog.seesaa.jp", 80);
$response = $client->send($message);
print_r($response);
ブログの開設(seesaa.newBlog)
require_once "XML/RPC.php";
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.newBlog",
array(
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string"),
new XML_RPC_Value(array(
"name"=> new XML_RPC_Value($blogName, "string"),
"title"=> new XML_RPC_Value($blogTitle, "string"),
"description"=> new XML_RPC_Value($blogDescription, "string"),
"nickname"=> new XML_RPC_Value($blogNickName, "string"),
"captcha_id"=> new XML_RPC_Value($captchaId, "string"),
"captcha_code"=> new XML_RPC_Value($captchaCode, "string"),
), "struct")
)
);
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"seesaa.newBlog",
array(
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string"),
new XML_RPC_Value(array(
"name"=> new XML_RPC_Value($blogName, "string"),
"title"=> new XML_RPC_Value($blogTitle, "string"),
"description"=> new XML_RPC_Value($blogDescription, "string"),
"nickname"=> new XML_RPC_Value($blogNickName, "string"),
"captcha_id"=> new XML_RPC_Value($captchaId, "string"),
"captcha_code"=> new XML_RPC_Value($captchaCode, "string"),
), "struct")
)
);
$client = new XML_RPC_client("/rpc", "blog.seesaa.jp", 80);
$response = $client->send($message);
print_r($response);
記事の投稿(metaWeblog.newPost)
require_once "XML/RPC.php";
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"metaWeblog.newPost",
array(
new XML_RPC_Value($blogId, "string"),
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string"),
new XML_RPC_Value(array(
"title"=> new XML_RPC_Value($title, "string"),
"description"=> new XML_RPC_Value($content, "string"),
"dateCreated"=> new XML_RPC_Value(date("Ymd\TH:i:s",
time()),
"dateTime.iso8601")
), "struct"),
new XML_RPC_Value(1, "boolean"),
)
);
$GLOBALS["XML_RPC_defencoding"] = "UTF-8";
$message = new XML_RPC_Message(
"metaWeblog.newPost",
array(
new XML_RPC_Value($blogId, "string"),
new XML_RPC_Value($userName, "string"),
new XML_RPC_Value($password, "string"),
new XML_RPC_Value(array(
"title"=> new XML_RPC_Value($title, "string"),
"description"=> new XML_RPC_Value($content, "string"),
"dateCreated"=> new XML_RPC_Value(date("Ymd\TH:i:s",
time()),
"dateTime.iso8601")
), "struct"),
new XML_RPC_Value(1, "boolean"),
)
);
$client = new XML_RPC_client("/rpc", "blog.seesaa.jp", 80);
$response = $client->send($message);
print_r($response);

