HOMER API Code Examples

The HOMER™ API is designed to be plain and self-explanatory. Therefore it takes a minimal amount of time to integrate HOMER into any new or already existing infrastructure.

Create a new webspace with PHP support and a disc quota of 50MiB

The return data of this command contains the unique id of the new webspace and its IP address.

command=addwebspace
class=php
quota=50
EOF

[RESPONSE]
code = 200
description = Command completed successfully
property[webspace][0]=webspace_mc29fyz9ek
property[ip][0]=217.188.214.193
property[price][0]=0.8
queuetime=0
runtime=2.82
EOF

Put a web address onto the webspace

After this command the webspace can be accessed via FTP and HTTP. If the host name name should not be used as the login name then the optional command login can be used to set another login name.

command=addwebhost
webspace=webspace_mc29fyz9ek
webhost=www.example.com
dir=/local_directory
ftppasswd=somepasswd
EOF

[RESPONSE]
code = 200
description = Command completed successfully;
version = 2.0.4
property[ip][0]=217.188.214.193
queuetime=0
runtime=0.853
EOF

PHP example code

require_once('libmreg.inc.php');
$command = array(
'command' => 'addwebspace',
'quota' => $megabytes,
'class' => 'php',
'period' => $months,
);
$return = mreg_call($command, $socket);
if ( $return['CODE'] == 200 ) {
# success
...

Perl example code

require('libmreg.pl');
my $command = {
'command' => 'addwebspace',
'quota' => $megabytes,
'class' => 'php',
'period' => $months
};
my $response = mreg_call($command, $socket);
if ( $response ->{'CODE'} == 200 ) {
# success
...