proxmox API vncproxy, vncwebsocket - noVNC

bacarrdy

New Member
Jun 23, 2015
1
0
1
Hello,

i`m trying to make PHP script to connect to proxmox specific VM via noVNC trough proxmox API.

I have created PHP script and can successfully connect to it with JAVA VNC, but cant connect with noVNC.
I`m using pve2-api-php-client and i have created script for JAVA VNC:

Code:
<?php
require("./pve2_class.php");
// NODE IP
$hostname = "111.111.111.111";
// VM ID
$vid = "11111";


$pve2 = new PVE2_API("111.111.111.111", "root", "pam", "password");


if (!empty($pve2)) {


    if ($pve2->login()) {
        foreach ($pve2->get_node_list() as $node_name) {
//            print_r($pve2->get("/nodes/".$node_name."/status"));


// specifing on what node vm exists
if ($node_name == "srv1") {
echo "<pre>";
echo "vncproxy POST\n";
$vncproxy = $pve2->post("/nodes/srv1/qemu/".$vid."/vncproxy");
print_r ($vncproxy);


$new_vncwebsocket = array();
$new_vncwebsocket['port'] = $vncproxy['port'];
$new_vncwebsocket['vncticket'] = $vncproxy['ticket'];


echo "vncwebsocket get\n";
$vncwebsocket = $pve2->get("/nodes/srv1/qemu/".$vid."/vncwebsocket", $new_vncwebsocket);
print_r ($vncwebsocket);

?>
<script>
PVE_vnc_console_event = function(appletid, action, err) {
}
</script>


<applet id='22222' border='true' code='com.tigervnc.vncviewer.VncViewer' archive='http://example.com/VncViewer.jar' width='150%' height='150%' style='width: 840px; height: 706px; '>
<param name='id' value='22222'>
<param name='PVECert' value='<?php echo str_replace("\n", '|', $vncproxy["cert"]); ?>'>
<param name='HOST' value='<?php echo $hostname; ?>'>
<param name='PORT' value='<?php echo $vncproxy["port"]; ?>'>
<param name='USERNAME' value='<?php echo $vncproxy["user"]; ?>'>
<param name='password' value='<?php echo $vncproxy["ticket"]; ?>'>
<param name='Show Controls' value='Yes'>
<param name='Offer Relogin' value='Yes'>
</applet>
<?php

echo "\n";
echo "<iframe src='novnc/vnc.php?name=".$vncproxy["user"]."&token=".base64_encode($vncproxy["ticket"])."'></iframe>\n";
}






        }
    } else {
        print("Login to Proxmox Host failed.\n");
        exit;
    }
} else {
    print("Could not create PVE2_API object.\n");
    exit;
}
?>

i have downloaded to my remote web page VncViewer.jar from proxmox page (because new java have security settings) and with JAVA applet everything works fine, but
Code:
 novnc/vnc.php?name=".$vncproxy["user"]."&token=".base64_encode($vncproxy["ticket"])
wont work at all
i have downloaded from proxmox page novnc folder too

so where can be problem?
how to make noVNC to work?

BTW i`m getting from vncproxy results like:
cert, user, upid, port, ticket
but i cant get anything from vncwebsocket

Thank you all for reading my post and Thank for all your posts
 
Last edited:
Hello,

i`m trying to make PHP script to connect to proxmox specific VM via noVNC trough proxmox API.

I have created PHP script and can successfully connect to it with JAVA VNC, but cant connect with noVNC.
I`m using pve2-api-php-client and i have created script for JAVA VNC:

you have any result at novnc?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!