我在ubuntu 16.04上使用php5.6。
以下代码使用php sirCamp / Xenapi。以下代码连接到本地Intranet上的Xen服务器上的计算机。
<?php
require __DIR__.'/vendor/autoload.php';
use Sircamp\Xenapi\Xen as Xen;
$ip='172.31.100.14';
$username='root';
$password='root@123';
try{
$xen = new Xen($ip,$username,$password);
}catch(XenConnectionException $e){
echo $e;
}
// $vm = $xen->getVMByNameLabel("centos6.7");
// echo $vm->getUUID()->getValue();
//$vm->cleanShutdown();
?>
它给出的错误是
Fatal error: Uncaught exception 'GuzzleHttp\Ring\Exception\RingException' with message 'Error creating resource: [message] URL is invalid: 172.31.100.14 [file] /var/www/htmt/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php [line] 403' in /var/www/html/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php:177 Stack trace: #0 /var/www/html/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php(412): GuzzleHttp\Ring\Client\StreamHandler->createResource(Object(Closure), Array, Array) #1 /var/www/html/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php(220): GuzzleHttp\Ring\Client\StreamHandler->createStreamResource('172.31.100.14', Array, Array, Resource id #5) #2 /var/www/html/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php(34): GuzzleHttp\Ring\Client\StreamHandler->createStream('172.31.100.14', Array) #3 /var/www/html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(129): GuzzleHttp\Ring\Client\StreamHandler->__invoke(Array) #4 /var/www/html in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 51
主机172.31.100.14我尝试连接是在线的,我可以ssh和ping它。但是使用php不会这样。