summaryrefslogtreecommitdiff
path: root/proxy.php
diff options
context:
space:
mode:
Diffstat (limited to 'proxy.php')
-rwxr-xr-xproxy.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/proxy.php b/proxy.php
new file mode 100755
index 0000000..149a1fa
--- /dev/null
+++ b/proxy.php
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<HTML>
+
+<HEAD>
+ <TITLE>PHP Proxy</TITLE>
+ <META http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <META name="robots" content="noindex"/>
+</HEAD>
+
+<BODY>
+
+<?php
+
+ $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ if ($socket === false)
+ echo "socket_create() failed: " . socket_strerror(socket_last_error()) . "<BR>\n";
+ else
+ echo "Socket OK.<BR>\n";
+
+ $result = socket_connect($socket, "localhost", 54321);
+
+ if ($result === false)
+ echo "socket_connect() failed: ($result) " . socket_strerror(socket_last_error($socket)) . "<BR>\n";
+ else
+ echo "Connect OK.<BR>\n";
+
+ socket_write($socket, $_GET["msg"], strlen($_GET["msg"]));
+
+ echo "Data sent!<BR>\n";
+ echo "Content: '" . $_GET["msg"] . "'.";
+
+?>
+
+</BODY>
+
+</HTML>