Wanting to get a variable from Telnet Server
Posted: Fri Dec 26, 2008 9:19 pm
I have been running FlightGear on my computer, which is an open source flight simulator.
In the set up you are able to output FlightGear's information through a built in Telnet Server. (http://localhost:5500/), which gives you a tree structure and you can actually input different things into the program through a web browser, potentially even flying a plane through this interaction.
Through the tree structure you can access all sorts of things and change the values (http://localhost:5500/position/latitude-deg) and the internal Telnet Server is generating a form written like this:
<html lang="en"><head>
<title>FlightGear - /position/latitude-deg</title>
</head><body>
<form method="get" action="/position/latitude-deg"><b>/position/latitude-deg</b> = <input name="value" size="15" value="37.61474135" maxlength="2047" type="text"><input value="update" name="submit" type="submit"></form></body></html>
What i want to do is to be able to interact with FlightGear independently from its served up pages, i.e., I want to access what it serves up from my own page, using PHP, to get a variable from the form(s) it is generating.
Here is something i have tried and it fails, giving me an undefined index value:
<?php
$page = file_get_contents('http://localhost:5500/position/latitude-deg');
echo $page;
$mvalue = $_REQUEST['value'];
echo $mvalue;
?>
Thank you for any time and input in advance.
In the set up you are able to output FlightGear's information through a built in Telnet Server. (http://localhost:5500/), which gives you a tree structure and you can actually input different things into the program through a web browser, potentially even flying a plane through this interaction.
Through the tree structure you can access all sorts of things and change the values (http://localhost:5500/position/latitude-deg) and the internal Telnet Server is generating a form written like this:
<html lang="en"><head>
<title>FlightGear - /position/latitude-deg</title>
</head><body>
<form method="get" action="/position/latitude-deg"><b>/position/latitude-deg</b> = <input name="value" size="15" value="37.61474135" maxlength="2047" type="text"><input value="update" name="submit" type="submit"></form></body></html>
What i want to do is to be able to interact with FlightGear independently from its served up pages, i.e., I want to access what it serves up from my own page, using PHP, to get a variable from the form(s) it is generating.
Here is something i have tried and it fails, giving me an undefined index value:
<?php
$page = file_get_contents('http://localhost:5500/position/latitude-deg');
echo $page;
$mvalue = $_REQUEST['value'];
echo $mvalue;
?>
Thank you for any time and input in advance.