summaryrefslogtreecommitdiff
path: root/proxy.php
blob: 149a1fad480912ce479ebbafac200a7d9c453c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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>