mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-09 22:51:22 +00:00
Removed old Java client, added new experimental PHP client.
This commit is contained in:
35
guacamole/client/tunnel.php
Normal file
35
guacamole/client/tunnel.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
# End all output buffers
|
||||
while (@ob_end_flush());
|
||||
|
||||
# Create socket
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, 0);
|
||||
if (!$socket) {
|
||||
die("error:Could not create socket.;");
|
||||
}
|
||||
|
||||
# Open connection
|
||||
$result = socket_connect($socket, "localhost", 2222);
|
||||
if (!$result) {
|
||||
die("error:Could not connect: " . socket_strerror(socket_last_error()) . ";");
|
||||
}
|
||||
|
||||
# Socket should block
|
||||
socket_set_block($socket);
|
||||
|
||||
# Write all data sent here
|
||||
socket_write($socket, file_get_contents("php://input"));
|
||||
|
||||
# Read until EOF
|
||||
while (($buffer = socket_read($socket, 8192))) {
|
||||
echo $buffer;
|
||||
flush();
|
||||
}
|
||||
|
||||
echo ";";
|
||||
|
||||
# Close socket
|
||||
socket_close($socket);
|
||||
|
||||
?>
|
Reference in New Issue
Block a user