使用 metaWeblog.newPost 向 Drupal 发表 PHPXMLRPC 博客文章:方法参数数量错误
我正在尝试将一个简单的文本字符串发布到我的 drupal 站点。 它需要使用 metaWeblog.newPost 完成,因为使用 blogger.newPost 将所有文本设置为标题。 我已经尝试过了。
到目前为止我已经得到了这个:
require_once('xmlrpc-v1.174.inc');
$appkey = "0001000";
$blogid = "blog";
$username = "xxxx";
$password = "xxxx";
$text = "testing";
$boolean = "true";
$content['title'] = "Testen van metaWeblog.newPost";
$content['description'] = $text;
$oMessage = new xmlrpcmsg('metaWeblog.newPost');
$oMessage->addParam( new xmlrpcval( $blogid , 'string' ));
$oMessage->addParam( new xmlrpcval( $username , 'string' ));
$oMessage->addParam( new xmlrpcval( $password , 'string' ));
$oMessage->addParam( $content , 'struct' );
$oMessage->addParam( new xmlrpcval( $boolean , 'boolean' ));
$oClient = new xmlrpc_client("http://example.nl/drupal/xmlrpc.php");
$oClient->setDebug(0);
$oResponse = $oClient->send( $oMessage );
if ($oResponse->faultCode() ) {
$xWebserviceOutput = $oResponse->faultString();
}
else
{
$oValue = $oResponse->value();
$xWebserviceOutput = $oValue->scalarval();
}
echo $xWebserviceOutput;
我已经使用了这个文档:
http: //www.sixapart.com/developers/xmlrpc/metaweblog_api/metaweblognewpost.html http://api.drupal.org/api/function/blogapi_metaweblog_new_post/6
它生成的错误如下:
Server error. Wrong number of method parameters.
有谁知道我做错了什么?
I'm trying to post a simple text string to my drupal site. It needs to be done with metaWeblog.newPost because with blogger.newPost sets all the text as title. I've already tried that one.
I've got this thus far:
require_once('xmlrpc-v1.174.inc');
$appkey = "0001000";
$blogid = "blog";
$username = "xxxx";
$password = "xxxx";
$text = "testing";
$boolean = "true";
$content['title'] = "Testen van metaWeblog.newPost";
$content['description'] = $text;
$oMessage = new xmlrpcmsg('metaWeblog.newPost');
$oMessage->addParam( new xmlrpcval( $blogid , 'string' ));
$oMessage->addParam( new xmlrpcval( $username , 'string' ));
$oMessage->addParam( new xmlrpcval( $password , 'string' ));
$oMessage->addParam( $content , 'struct' );
$oMessage->addParam( new xmlrpcval( $boolean , 'boolean' ));
$oClient = new xmlrpc_client("http://example.nl/drupal/xmlrpc.php");
$oClient->setDebug(0);
$oResponse = $oClient->send( $oMessage );
if ($oResponse->faultCode() ) {
$xWebserviceOutput = $oResponse->faultString();
}
else
{
$oValue = $oResponse->value();
$xWebserviceOutput = $oValue->scalarval();
}
echo $xWebserviceOutput;
I'm have used this documentation:
http://www.sixapart.com/developers/xmlrpc/metaweblog_api/metaweblognewpost.html
http://expressionengine.com/wiki/How_to_add_an_entry_using_PHP_and_Metaweblog_API/
http://api.drupal.org/api/function/blogapi_metaweblog_new_post/6
The error it generates is the following:
Server error. Wrong number of method parameters.
Does anyone know what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
Solution: