如何以编程方式将博客发布到wordpress
我正在寻找API,我可以使用它以编程方式发布WordPress上的博客。 请注意,我想将用户重定向到wordpress,因此我正在寻找一个“GET”wordpress API。如何以编程方式将博客发布到wordpress
Wordpress支持Atom发布协议和XML-RPC。简化解决方案可能是使用邮件后功能。您的程序可通过电子邮件发送博客条目。
你能指点我一些使用Atom发布协议和XML-RPC的例子以及如何在代码中使用它吗? – TopCoder 2011-02-02 12:20:11
我还没有必要这样做,但这里有一个很好的起点(由Eric Kidd编写):http://tldp.org/HOWTO/XML-RPC-HOWTO/index.html – 2011-02-02 12:41:23
也请看博客这里的API:http://www.xmlrpc.com/ – 2011-02-02 12:44:02
可以使用WordPress的功能wp_insert_post
// Create post object
$my_post = array(
'post_title' => 'My post',
'post_content' => 'This is my post.',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array(8,39)
);
// Insert the post into the database
wp_insert_post($my_post);
你是说HTTP职位是不是可行?如果你确实重定向到WordPress,那么正常的重定向如何不能满足这种需求?我对你想要的东西有点困惑。 – 2011-02-02 12:48:19