My current task now is propagating variables from script to script. Basically, I have coded a capability into my website to insert 4 variables into a database via a form get method.
Now, I have input coming from a Android app that posts information to my website using JSON. After decoding the JSON array and turning them into 4 variables, how do I take those four variables and propagate them to the same script that inserts them into the database?
Here is the code for the mobile php script server side.
<?php
session_start();
$json = $_SERVER['HTTP_JSON'];
$data = json_decode($json);
$Latitude = $data->Latitude;
$Longitude = $data->Longitude;
$Bldg = $data->Bldg;
$Room = $data->Room;
echo "Data Received. Thanks bruh!";
?>
And here is the script I want to send it to.
<?php
session_start();
$bld =$_POST["bld"];
$rnum =$_POST["rnum"];
$lat = $_POST["lati"];
$lon = $_POST["longi"];
//LOG ON AND ENTER INFORMATION INTO DATABASE
require_once('logconf.php');
try {
$dbh = new PDO($driver, $user, $pass, $attr);
} catch (Exception $e) {
echo 'Exception : ' . $e->getMessage() . "\n";
die();
}
.......