php xml-rpc:使用 metaWeblog.newPost 向 drupal 发布博客文章时出错
我尝试使用 xml-rpc 将简单的博客文章发布到 drupal 站点。我为此使用 IXR_Library。
这是我使用 metaWeblog.newPost 的示例代码:
$url = 'http://drupalpage.de/xmlrpc.php';
$user = 'drupaluser';
$pass = 'drupalpass';
$post = array(
'title' => 'New Title'
'description' => 'Some content…'
);
$IXR = new IXR_Client($url);
$status = $IXR->query('metaWeblog.newPost',
'1',
$user,
$pass,
$post,
true
);
当我调用这个脚本时,我从 drupal 得到以下返回:
[params] => Array
(
[0] => Array
(
[faultCode] => 1
[faultString] => Entweder versuchten Sie einen fremden Blog zu editieren oder Sie haben keine Berechtigung Ihren eigenen Blog zu editieren.
)
)
我不知道为什么我从 drupal 系统得到这个“权限通知”。我可以使用变量 $user/$pass 中的值准确登录系统。
更多信息:当我调用“system.listMethods”时,我得到以下返回:
[0] => Array
(
[0] => system.multicall
[1] => system.methodSignature
[2] => system.getCapabilities
[3] => system.listMethods
[4] => system.methodHelp
[5] => blogger.getUsersBlogs
[6] => blogger.getUserInfo
[7] => blogger.newPost
[8] => blogger.editPost
[9] => blogger.getPost
[10] => blogger.deletePost
[11] => blogger.getRecentPosts
[12] => metaWeblog.newPost
[13] => metaWeblog.editPost
[14] => metaWeblog.getPost
[15] => metaWeblog.newMediaObject
[16] => metaWeblog.getCategories
[17] => metaWeblog.getRecentPosts
[18] => mt.getRecentPostTitles
[19] => mt.getCategoryList
[20] => mt.getPostCategories
[21] => mt.setPostCategories
[22] => mt.supportedMethods
[23] => mt.supportedTextFilters
[24] => mt.getTrackbackPings
[25] => mt.publishPost
)
当我调用“metaWeblog.getCategories”时,我得到一个正确的返回数组,其中包含来自 drupal 系统的类别。
我尝试了很多其他变体来解决我的问题。但是,当我调用“blogger.getUsersBlogs”或“blogger.getUserInfo”时,我会得到相同的权限通知。
有谁知道我做错了什么?
I trying to post a simple blog-post to a drupal-site with xml-rpc. I use the IXR_Library for this.
Here is my example-code using metaWeblog.newPost:
$url = 'http://drupalpage.de/xmlrpc.php';
$user = 'drupaluser';
$pass = 'drupalpass';
$post = array(
'title' => 'New Title'
'description' => 'Some content…'
);
$IXR = new IXR_Client($url);
$status = $IXR->query('metaWeblog.newPost',
'1',
$user,
$pass,
$post,
true
);
When I call this script I get the following return from drupal:
[params] => Array
(
[0] => Array
(
[faultCode] => 1
[faultString] => Entweder versuchten Sie einen fremden Blog zu editieren oder Sie haben keine Berechtigung Ihren eigenen Blog zu editieren.
)
)
I don’t know why I get this „permission-notice“ from the drupal-system. I can login to the system with exactly the value in the variables $user/$pass.
Some more infos: When I call ‘system.listMethods’ I get the following return:
[0] => Array
(
[0] => system.multicall
[1] => system.methodSignature
[2] => system.getCapabilities
[3] => system.listMethods
[4] => system.methodHelp
[5] => blogger.getUsersBlogs
[6] => blogger.getUserInfo
[7] => blogger.newPost
[8] => blogger.editPost
[9] => blogger.getPost
[10] => blogger.deletePost
[11] => blogger.getRecentPosts
[12] => metaWeblog.newPost
[13] => metaWeblog.editPost
[14] => metaWeblog.getPost
[15] => metaWeblog.newMediaObject
[16] => metaWeblog.getCategories
[17] => metaWeblog.getRecentPosts
[18] => mt.getRecentPostTitles
[19] => mt.getCategoryList
[20] => mt.getPostCategories
[21] => mt.setPostCategories
[22] => mt.supportedMethods
[23] => mt.supportedTextFilters
[24] => mt.getTrackbackPings
[25] => mt.publishPost
)
When I call ‘metaWeblog.getCategories’ I get a correct return-array with the categories from the drupal-system.
I tried a lot of other variants to solve my problem. But when I call ‘blogger.getUsersBlogs’ or ‘blogger.getUserInfo’ I get the same permission-notice.
Does anyone know what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论