clienttest.php revision b7307c9c040a1a8aed0dbabed6574466d0bff2e4
2bca4de967f80471d18eb768fc6911261327520eslive * Sample client for the VirtualBox webservice, written in PHP.
2bca4de967f80471d18eb768fc6911261327520eslive * Run the VirtualBox web service server first; see the VirtualBox
5a58787efeb02a1c3f06569d019ad81fd2efa06end * SDK reference for details.
5a58787efeb02a1c3f06569d019ad81fd2efa06end * Copyright (C) 2009-2010 Oracle Corporation
5a58787efeb02a1c3f06569d019ad81fd2efa06end * Contributed by James Lucas (mjlucas at eng.uts.edu.au).
5a58787efeb02a1c3f06569d019ad81fd2efa06end * The following license applies to this file only:
5a58787efeb02a1c3f06569d019ad81fd2efa06end * Permission is hereby granted, free of charge, to any person
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz * obtaining a copy of this software and associated documentation
5a58787efeb02a1c3f06569d019ad81fd2efa06end * files (the "Software"), to deal in the Software without
5a58787efeb02a1c3f06569d019ad81fd2efa06end * restriction, including without limitation the rights to use,
5a58787efeb02a1c3f06569d019ad81fd2efa06end * copy, modify, merge, publish, distribute, sublicense, and/or
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz * sell copies of the Software, and to permit persons to whom the
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * Software is furnished to do so, subject to the following conditions:
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * The above copyright notice and this permission notice shall be
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * included in all copies or substantial portions of the Software.
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
ec878843fb39a84bac1e1c2e1a2b821b1b7882fend * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
2bca4de967f80471d18eb768fc6911261327520eslive * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2bca4de967f80471d18eb768fc6911261327520eslive * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2bca4de967f80471d18eb768fc6911261327520eslive * OTHER DEALINGS IN THE SOFTWARE.
25d005c58102474e06fb67d748273b161d7198d0pquernarequire_once('./vboxServiceWrappers.php");
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz//Connect to webservice
25d005c58102474e06fb67d748273b161d7198d0pquerna$connection = new SoapClient("vboxwebService.wsdl", array('location" => "http://localhost:18083/"));
5a58787efeb02a1c3f06569d019ad81fd2efa06end//Logon to webservice
5a58787efeb02a1c3f06569d019ad81fd2efa06end// Dummy username and password (change to appropriate values or set authentication method to null)
5a58787efeb02a1c3f06569d019ad81fd2efa06end$virtualbox = $websessionManager->logon("username","password");
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz//Get a list of registered machines
5a58787efeb02a1c3f06569d019ad81fd2efa06end//Take a screenshot of the first vm we find that is running
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen $session = $websessionManager->getSessionObject($virtualbox->handle);
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen list($screenWidth, $screenHeight, $screenBpp, $screenX, $screenY, $screenStatus) = $display->getScreenResolution(0 /* First screen */);
5a58787efeb02a1c3f06569d019ad81fd2efa06end $imageraw = $display->takeScreenShotToArray(0 /* First screen */, $screenWidth, $screenHeight, "RGBA");
5a58787efeb02a1c3f06569d019ad81fd2efa06end echo "Saving screenshot of " . $machine->name . " (${screenWidth}x${screenHeight}, ${screenBpp}BPP) to $filename\n";
5a58787efeb02a1c3f06569d019ad81fd2efa06end $image = imagecreatetruecolor($screenWidth, $screenHeight);
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd //$alpha = $image[$start+3];