Libvirt-Manager/example.php

12 lines
473 B
PHP
Raw Normal View History

2018-09-28 01:33:48 +08:00
<?php
Header("Content-type: text/plain");
// Include Libvirt libraries
2018-09-28 01:33:48 +08:00
include("libvirt/libvirt.php");
// Instantiation Libvirt
2018-09-28 01:33:48 +08:00
$Libvirt = new Libvirt();
// Connect to 192.168.3.181:22 and set libvirt root at /data/libvirt/
2018-09-28 01:33:48 +08:00
$Libvirt->setHost("192.168.3.181", 22, "/data/libvirt/");
// Use the username 'root' and the password '123456' login to server.
2018-09-28 01:33:48 +08:00
$Libvirt->connect("root", "123456");
// Print the virtual machine centos's config file.
echo $Libvirt->dumpxml("centos");