PHP code example of ghasemy50 / vmware-api
1. Go to this page and download the library: Download ghasemy50/vmware-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ghasemy50 / vmware-api example snippets
// Create a new API instance, endpoint should end on "/rest/".
$api = new \MartinMulder\VMWare\[Vcenter|Appliance|Inventory]IApi('https://vcenter.local/rest/');
// LEGACY LOGIN WITH TOKEN
$api->login('yourusername', 'yourpassword');
$vms = $api->getListOfVms();
foreach($vms as $vm) {
var_dump($vm);
}