简体   繁体   English

用PHP编写Cobbler XMLRPC调用

[英]Cobbler XMLRPC calls with PHP

I'm new to xmlrpc and I've been trying to integrate with a cobbler server in order to pull some info out of it. 我是xmlrpc的新手,并且我一直在尝试与补鞋匠服务器集成以便从中获取一些信息。 Unfortunately, the documentation is at best, sparse so I need some help. 不幸的是,文档充其量是稀疏的,因此我需要一些帮助。

The xmlrpc info for cobbler is here 补鞋匠的xmlrpc信息在这里

https://fedorahosted.org/cobbler/wiki/CobblerXmlrpc https://fedorahosted.org/cobbler/wiki/CobblerXmlrpc

using a process of elimnation, I've thrown together this test code in order to try pull some stuff. 通过消除的过程,我将这些测试代码组合在一起,以尝试提取一些东西。

<?php
include 'xmlrpc.inc';
// Make an object to represent our server.

$server = new xmlrpc_client('https://url/cobbler/cobbler_api'); 
$token = $server->login("username","password");   
echo $server->getprofiles("name");   
?>

I get precisely nothing. 我什么也没得到。 So, what have I done wrong? 那么,我做错了什么? How can i check the request is actually being performed correctly. 我如何检查请求是否正确执行。

obviously I've replaced url username and password for the purposes of this question 显然,出于这个问题的目的,我已经替换了url usernamepassword

Have you enabled XMLRPC access in cobbler? 您是否在补鞋匠中启用了XMLRPC访问? I found the following in their documentation: 我在他们的文档中发现了以下内容:

This disables all external XMLRPC modifications, and also disables the Cobbler Web interface. 这将禁用所有外部XMLRPC修改,并且还将禁用Cobbler Web界面。 Use this if you do not want to allow any external access and do not want to use the web interface. 如果您不想允许任何外部访问并且不想使用Web界面,请使用此选项。 This is the default setting in Cobbler for new installations 这是Cobbler中新安装的默认设置

Have a look here on how to enable XMLRPC on your server 在这里看看如何在服务器上启用XMLRPC

I seem to have fixed this myself. 我似乎自己已经解决了这个问题。

I used Intutio's XMLRPC library and it worked like a charm, made it much easier once I'd included that. 我使用了Intutio的XMLRPC库,它像一个魅力一样工作,一旦包含它,它就变得容易得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM