PHP + IceSecret

Ice/DBus, Web-Interfaces, Management tools

PHP + IceSecret

Postby graveeater » Mon Mar 29, 2010 5:52 pm

Hi all,
I already asked in the sf help board, but I have the feeling that this board is kinda undervisited.

So I am asking here again.

How can I access Ice from PHP if I want to use the icesecret feature (which works fine with python).
I have checked a couple of projects, but none seems to use icesecret so I am beginning to doubt that it is possible.
If so, has anyone some hints how to secure my connection otherwise? Should I use Glacier?
graveeater
 
Posts: 3
Joined: Mon Mar 29, 2010 5:49 pm

Re: PHP + IceSecret

Postby ipnoz » Wed Mar 31, 2010 7:33 am

Hi.
It's possible to set the icesecret with php: ice_context().

Example:

$ICEsecret = array( 'secret' => 'yourSecretWord' );

$proxy = $ICE->stringToProxy( "Meta:tcp -h $iceIP -p $icePORT -t $TIMEOUT" );
$meta = $proxy->ice_checkedCast('::Murmur::Meta')->ice_context( $ICEsecret );

So the icesecret is set for the meta interface:

$meta->newServer();
$meta->getAllServers();
$meta->getUptime();
etc...

Unlikely for python, ice-php 3.2 & 3.3 don't have the getImplicitContext function, so when you call a server methode with getServer(), getAllServers() or getBootedServers(), you have to set the icesecret again:

$server = $meta->getServer( intval( $serverID ) )->ice_context( $ICEsecret );
echo $server->id();

$getAllServers = $meta->getAllServers();
foreach( $getAllServers as $server ) {
$server = $server->ice_context( $ICEsecret );
echo $server->id();
}

It's works :)
ipnoz
 
Posts: 2
Joined: Tue Feb 09, 2010 10:16 pm

Re: PHP + IceSecret

Postby graveeater » Wed Mar 31, 2010 9:50 am

Thank you for your reply. I will try this out later.
graveeater
 
Posts: 3
Joined: Mon Mar 29, 2010 5:49 pm


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron