commit | author | age
|
077c27
|
1 |
<?php |
T |
2 |
|
b1a6a5
|
3 |
require 'soap_config.php'; |
077c27
|
4 |
|
T |
5 |
|
|
6 |
$client = new SoapClient(null, array('location' => $soap_location, |
b1a6a5
|
7 |
'uri' => $soap_uri, |
MC |
8 |
'trace' => 1, |
|
9 |
'exceptions' => 1)); |
077c27
|
10 |
|
T |
11 |
|
|
12 |
try { |
b1a6a5
|
13 |
if($session_id = $client->login($username, $password)) { |
077c27
|
14 |
echo 'Logged successfull. Session ID:'.$session_id.'<br />'; |
T |
15 |
} |
b1a6a5
|
16 |
|
077c27
|
17 |
//* Set the function parameters. |
413d3b
|
18 |
$client_id = 1; |
T |
19 |
$params = array( |
b1a6a5
|
20 |
'server_id' => 1, |
MC |
21 |
'veid' => 1, |
|
22 |
'ostemplate_id' => 0, |
|
23 |
'template_id' => 0, |
|
24 |
'ip_address' => '192.168.0.111', |
|
25 |
'hostname' => 'host', |
|
26 |
'vm_password' => 'password', |
|
27 |
'start_boot' => 'y', |
|
28 |
'active' => 'y', |
|
29 |
'active_until_date' => '', |
|
30 |
'description' => '', |
|
31 |
'diskspace' => 10, |
|
32 |
'traffic' => -1, |
|
33 |
'bandwidth' => -1, |
|
34 |
'ram' => 256, |
|
35 |
'ram_burst' => 512, |
|
36 |
'cpu_units' => 1000, |
|
37 |
'cpu_num' => 4, |
|
38 |
'cpu_limit' => 400, |
|
39 |
'io_priority' => 4, |
|
40 |
'nameserver' => '8.8.8.8 8.8.4.4', |
|
41 |
'create_dns' => 'n', |
|
42 |
'capability' => '', |
|
43 |
'config' => '' |
|
44 |
); |
|
45 |
|
413d3b
|
46 |
$vm_id = $client->openvz_vm_add($session_id, $client_id, $params); |
T |
47 |
|
|
48 |
echo "VM ID: ".$vm_id."<br>"; |
b1a6a5
|
49 |
|
077c27
|
50 |
if($client->logout($session_id)) { |
T |
51 |
echo 'Logged out.<br />'; |
|
52 |
} |
b1a6a5
|
53 |
|
MC |
54 |
|
077c27
|
55 |
} catch (SoapFault $e) { |
T |
56 |
echo $client->__getLastResponse(); |
|
57 |
die('SOAP Error: '.$e->getMessage()); |
|
58 |
} |
|
59 |
|
|
60 |
?> |