'How can I Deploy OVF from VmwarePHP Libray

I'm trying to deploy ovf from vmwarephp library, but I failed every time, unfortunately.

I've been trying for 5 hours. Please can you help guys?

How should the code be?

$vhost = new \Vmwarephp\Vhost('192.168.0.24', 'root', '1225548963145');

$vm = $vhost->findManagedObjectByName("VirtualMachine", "192.168.0.25", array());

$resourcePool = $vhost->findOneManagedObject('ResourcePool', 'ha-root-pool', array());

$dataCenter = $vhost->findOneManagedObject('Datacenter', 'ha-datacenter', array());


$content = $vhost->getServiceContent();

$ovfManager = $content->ovfManager;
$ovfSpecParams = new OvfCreateImportSpecParams();
$ovfSpecParams->locale = 'US';
$ovfSpecParams->deploymentOption = Null;

/*

$myfile = fopen("centos_7_64.ova", "r") or die("Unable to open file!");
$ova = fread($myfile,filesize("centos_7_64.ova"));
fclose($myfile);
*/


$importSpec = $ovfManager->CreateImportSpec(['ovfDescriptor' => 'centos_7_64.ova', 'resourcePool' => 'ha-root-pool', 'datastore' => 'datastore1', 'cisp' => $ovfSpecParams]);


$resourcePool->ImportVApp(['spec' => $importSpec->importSpec, 'folder' => 'ha-folder-vm']);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source