- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试通过 XMLRPC 将多个类别添加到 Wordpress (3.3.1) 帖子。
这是我的代码(运行良好,请阅读下文):
<?
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once("IXR_Library.php.inc"); // http://www.hurricanesoftwares.com/php_uploads/IXR_Library.txt
$client->debug = true; //Set it to false in Production Environment
$title="Blog Title5"; // $title variable will insert your blog title
$body = "teste xmlrpc <a href='http://www.teste.com'>teste.com</a>";
$category="DVDSCR, Telesync"; // Comma seperated pre existing categories. Ensure that these categories exists in your blog.
$keywords="keyword1, keyword2, keyword3";
$customfields=array('key'=>'Author-bio', 'value'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format
$title = htmlentities($title,ENT_NOQUOTES,$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post',
'mt_keywords'=>$keywords,
'categories'=>array($category),
'custom_fields' => array($customfields)
);
// Create the client object
$client = new IXR_Client('http://127.0.0.1/xmlrpc.php');
$username = "admin";
$password = "password";
$params = array(0,$username,$password,$content,true); // Last parameter is 'true' which means post immideately, to save as draft set it as 'false'
// Run a query for PHP
if (!$client->query('metaWeblog.newPost', $params)) {
die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}
else
echo "Article Posted Successfully";
?>
错误:
如果我尝试添加多个类别,帖子类别将设置为未分类(默认)。
我已经试过了:
$category = "telesync, dvdscr";
还有这个:
$category =array('telesync','dvdscr');
如何在帖子中添加多个类别?谢谢大家!
最佳答案
我在测试了一些其他选项后找到了答案,例如:
'categories'=>array("telesync", "1080p"),
$content 变量看起来像这样:
$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post',
'mt_keywords'=>$keywords,
'categories'=>array("telesync", "1080p"), // I've typed the categories directly here.
'custom_fields' => array($customfields)
);
关于php - Wordpress 通过 XMLRPC 发布 - 添加多个类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9221859/
服务器代码(基于 Python 库引用): from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleX
有什么方法可以同时从一个 xmlrpc 客户端向不同的 xmlrpc 服务器发出多个调用。 我的服务器代码如下所示:(我将让这段代码在两台机器上运行,server1 和 server2) class
我在我的 Apache 服务器上安装了 xmlrpc-epi,我需要使用它来连接到 XMLRPC 服务器。我应该做什么 - 除了 xmlprc-api 之外,我还需要在我的服务器上下载和/或安装什么吗
我正在构建一个使用wordpress-java库的android应用,但出现了"Failed to resolve: redstone.xmlrpc:xmlrpc:1.1.1"错误。 Build.Gr
实际上需要传递一个参数,该参数是一个xml作为带有xmlrpc Node 模块的对象github.com/baalexander/node-xmlrpc; 客户端调用是: client.methodC
我有一个运行 Python 的 XML RPC 服务器。 它作为 SimpleXMLRPCServer 类的实例实现。 from SimpleXMLRPCServer import SimpleXML
我不会从表格中读取行来将主题放在列表中 php脚本 $url_obj='http://'.$host.':8069/xmlrpc/object'; $sock=new xmlrpc_client($u
如何将脚本执行错误传递给 XMLRPC 响应,以免出现故障异常? 也许我没有正确设置: 在 XMLRPC 服务器中,我添加了 Zend_XmlRpc_Server_Fault::attachFault
有关如何使用 XMLRPC 实现基本身份验证的任何线索或示例org.apache.xmlrpc.webserver.WebServer? 我正在使用 Java API apache-xmlrpc-3.
我有一个使用 GHC 运行的 Haskell RPCXML (HaXR) 服务器进程,它需要执行它传递的任何函数。这些函数都将在运行时定义,因此编译后的服务器不会知道它们。 有没有办法在运行时加载函数
我使用 xmlrpc 服务器运行简单示例,然后按键盘上的 Ctrl-C :)。 from SimpleXMLRPCServer import SimpleXMLRPCServerfrom time i
我正在使用 HTML5 + Phonegap 进行移动应用程序开发。目前正在使用 XMLRPC 开发移动应用程序,并且运行良好。 (Android 和 iOS) 我需要在浏览器中运行与网站 相同的应用
我想创建非阻塞扭曲的 xmlrpc,但我不知道。我想在 xmlrpc 中调用方法,并且每次都从任何客户端执行我的方法,无需等待。这是我的代码: from pymongo import MongoCli
是否有可能允许 Python simplexmlrpc 服务器的 xmlrpc 扩展(数据类型 long int)? 客户端使用 Apache xmlrpc,allows 8 byte integer
我正在寻找一种方法来防止多个主机同时向 Python XMLRPC 监听器发出命令。监听器负责运行脚本以在该系统上执行任务,如果多个用户试图同时发出这些命令,这些任务将会失败。有没有一种方法可以阻止所
本文整理了Java中org.apache.xmlrpc.XmlRpcConfig类的一些代码示例,展示了XmlRpcConfig类的具体用法。这些代码示例主要来源于Github/Stackoverfl
对你们来说很简单的问题。 我可以通过 xmlrpc 删除未附加的媒体吗?如果是这样,请指导我了解什么功能可以做到这一点。谢谢 最佳答案 绝对可以,你用wp.deletePost以 post_id 作为
我的任务是创建一个 API,用于从 Flash 应用程序和旧版 CMS(非 PHP)检索内容并将其添加到 Wordpress。我的计划是利用现有的默认 xmlrpc 端点,并通过创建一个 Hook 到
所以我有一个 XMLRPC 服务器,它有一个名为 start_apps 的命令 通常从Python我会像这样运行它 import xmlrpclib app=xmlrpclib.ServerProxy
所以我有一个 XMLRPC 服务器,它有一个名为 start_apps 的命令 通常从Python我会像这样运行它 import xmlrpclib app=xmlrpclib.ServerProxy
我是一名优秀的程序员,十分优秀!