<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WoodyVillage &#187; PHP</title>
	<atom:link href="http://www.woody-village.com/archives/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.woody-village.com</link>
	<description></description>
	<lastBuildDate>Sat, 14 Aug 2010 04:30:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPressにXML-RPCで投稿＠PHP</title>
		<link>http://www.woody-village.com/archives/419</link>
		<comments>http://www.woody-village.com/archives/419#comments</comments>
		<pubDate>Tue, 17 Nov 2009 13:28:30 +0000</pubDate>
		<dc:creator>premier</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.woody-village.com/?p=419</guid>
		<description><![CDATA[
pearのXML_RPCモジュールをインストールしておく

# pear install XML_RPC




↓　ソースここから。

require_once("XML/RPC.php");

$host = "hogehoge.com"; // WordPressのHost名
$user = "username"; // WordPressのユーザ名
$pass = "password"; // WordPressのパスワード
$xmlrpc = "/xmlrpc.php"; // XMLRPCのパス
$port = 80; // ポート番号
$blogid = 1; // blog ID

$title = "記事のタイトル";
$description = "記事の本文";
$publish = 1; // 0:下書き、1:公開

$category1 = 1; // カテゴリID
$category2 = 5; // カテゴリID
$category3 = 8; // カテゴリID


/* 投稿処理 */
// クライアント生成
$Client = new XML_RPC_client($xmlrpc, [...]]]></description>
			<content:encoded><![CDATA[<p>
pearのXML_RPCモジュールをインストールしておく<br />
<br />
# pear install XML_RPC<br />
<br />
<br />
<br />
<br />
↓　ソースここから。<br />
<pre>
require_once("XML/RPC.php");

$host = "hogehoge.com"; // WordPressのHost名
$user = "username"; // WordPressのユーザ名
$pass = "password"; // WordPressのパスワード
$xmlrpc = "/xmlrpc.php"; // XMLRPCのパス
$port = 80; // ポート番号
$blogid = 1; // blog ID

$title = "記事のタイトル";
$description = "記事の本文";
$publish = 1; // 0:下書き、1:公開

$category1 = 1; // カテゴリID
$category2 = 5; // カテゴリID
$category3 = 8; // カテゴリID


/* 投稿処理 */
// クライアント生成
$Client = new XML_RPC_client($xmlrpc, $host, $port);

// メッセージ作成
$Message = new XML_RPC_Message(
  "metaWeblog.newPost",
  array( new XML_RPC_Value($blogid, "string"),
         new XML_RPC_Value($user, "string"),
         new XML_RPC_Value($pass, "string"),
         new XML_RPC_Value( array( "title" => new XML_RPC_Value($title, 'string'),
                                   "description" => new XML_RPC_Value($description, 'string'),
                                   "dateCreated" => new XML_RPC_Value("", 'string') // 投稿日時
                                 ), "struct"
                          ),
         new XML_RPC_Value($publish, "boolean")
       )
);

// メッセージ送信
if(!$Response = $Client->send($Message)){
	echo "Post failed.";
}


/* カテゴリ変更 */
// Post ID取得
$Buf = $Response->value();
$PostId = $Buf->me["string"];

// カテゴリ指定
$CateList = array( new XML_RPC_Value($category1, "int"),
                   new XML_RPC_Value($category2, "int"),
                   new XML_RPC_Value($category3, "int")
                 );
$Category = new XML_RPC_Value($CateList, "struct");

// メッセージ作成
$Message = new XML_RPC_Message(
  "mt.setPostCategories",
  array( new XML_RPC_Value($PostId, "int"),
         new XML_RPC_Value($user, "string"),
         new XML_RPC_Value($pass, "string"),
         $Category
       )
);

// メッセージ送信
if(!$Response = $Client->send($Message)){
	echo "Category change failed.";
}
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.woody-village.com/archives/419/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
