Dne 9.8.2011 04:03, Jeremy Davis napsal(a):
List,
I am looking to use php for a web tool that I am creating that uses the
Spacewalk API. I was wanting to know if anyone has used PHP to work with
the Spacewalk API and if so could provide me some example code and
libraries used. Any assistance you could provide would be greatly
appreciated.
See
http://phpxmlrpc.sourceforge.net/doc-2/ch07s03.html
I tried to rewrite example script, which you can find at your spacewalk
at /rhn/apidoc/scripts.jsp to PHP.
$SATELLITE_LOGIN = "username"
$SATELLITE_PASSWORD = "password"
$client = new xmlrpc_client("http://satellite.example.com/rpc/api");
$client->return_type = 'phpvals';
$message = new xmlrpcmsg("auth.login", array(new
xmlrpcval($SATELLITE_LOGIN, "string"), new
xmlrpcval($SATELLITE_PASSWORD, "string")));
$resp = $client->send($message);
$key = $resp->value();
$message = new xmlrpcmsg("user.list_users", array(new xmlrpcval($key,
"string")));
foreach ($resp->value() as $user) {
echo $user['login']
}
I wrote that from top of my head. I did not wrote in PHP for ages, so
pardon me if there is some typo. If it actually works, I would be glad
for the feedback and I may add it to example scripts.
Mirek
_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list