<html>
<head></head>
<body>

<?
if ($_POST['command']){
echo $_POST['addr'].':'.$_POST['port'];
echo $_POST['command'].'<br>';

	 //$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);
	$fp = fsockopen($_POST['addr'], $_POST['port'], $errno, $errstr);

	if (!$fp) {
			echo "ERROR: $errno - $errstr<br>\n";
		} else {
		
			$sent = fwrite($fp, stripslashes($_POST['command']));
			if ($sent){
			echo "sent";
			//echo fread($fp, 26);
			fclose($fp);
			}
	}
}

?>

<h1>UDP input form</h1>
<form name="udp_form" method="post">
Send To Addr <input name="addr" type="text" value="udp://phosphorus.fal.buffalo.edu">
Port <input name="port" type="text" value="4550">
Command <input name="command" type="text">
<input type="submit" value="go" name="submit">
</form>
</body></head></html>
