Hi all,
I'm trying to output all the variables sent to a form to a txt file. As I want all the variables sent and I don't know all the variables being sent I thought that I would catch them in a txt file. I have to use a txt file as the variables are coming from 3rd party software directly and no web page is ever opened.
The code I'm using is:
Also included are the variables I know of
<?php
$variables = print_r($_REQUEST);
$pilot = $_GET['pilot'];
$date = $_GET['date'];
$time = $_GET['time'];
$callsign = $_GET['callsign'];
$reg = $_GET['reg'];
$origin = $_GET['origin'];
$dest = $_GET['dest'];
$equipment = $_GET['equipment'];
$fuel = $_GET['fuel'];
$duration = $_GET['duration'];
$distance = $_GET['distance'];
$rep_url = "Dummy";
$more = $_GET['more'];
$fsacars_log = $_GET['log'];
// use ini from pilot folder and append PilotNumber & variable to end EOF
$filereal_name = 'vars.txt';
$somecontent = $variables . $pilots . $time . $date ;
$fileneeded = "<a href=http://www.mydomian.com/fsacars";
if (is_writable($filereal_name)) {
if (!$handle = fopen($filereal_name, 'a')) {
echo "Cannot open file ($filereal_name)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filereal_name)";
exit;
}
echo "Please download your ini file for: $fileneeded/$filereal_name> $newUser</a><br>";
fclose($handle);
} else {
echo "The file $filereal_name is not writable";
}
?>
Where I'm having a problem is the "$variables = print_r($_REQUEST);" the other variables work fine and output OK. But I'm more interested in getting the unknown variables to the txt file. After all, the whole point of me doing this is to find all the variables.
The variables are coming from 3rd party software which submits a report to a php file on the server. The variable names are not clearly defined in the help doc so I thought by catching them this way, it would do the trick.
So can anyone see where I've gone wrong? If you can help that would be great.
Thanks
Steph.
PS. I've only just started using php a week or so ago, so be easy on me. 😕