119977 2008-10-6 20:34
wordpress XML-RPC PHP发表带有html代码的文章
[code]<?php
include("xmlrpc.inc");
$c = new xmlrpc_client("wordpress/xmlrpc.php", "localhost", 80);
$content['title']="XMLRPC Post"; //标题
$content['description']="<a href="https://addons.mozilla.org/zh-CN/firefox/downloads/file/1854/betfair_toolbar-0.0.3-fx.xpi">gdfgt</a>"; //内容
$content['wp_author_id']="1"; //发帖人ID
$content['mt_keywords']="878,787"; //标签
$content['wp_password']=""; //文章密码,输入后显示加密
$content['categories'] = array("2"); //分类名
$x = new xmlrpcmsg("metaWeblog.newPost",
array(php_xmlrpc_encode("1"),
php_xmlrpc_encode("admin"), //用户名
php_xmlrpc_encode("admin"), //密码
php_xmlrpc_encode($content),
php_xmlrpc_encode("1")));
$c->return_type = 'phpvals';
$r =$c->send($x);
if ($r->errno=="0")
echo "Successfully Posted";
else {
echo "There are some error";
print_r($r);
}
?>[/code][attach]5236[/attach]
[[i] 本帖最后由 119977 于 2008-10-7 13:19 编辑 [/i]]