forked from shubhajitml/ecobin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensor_data.php
executable file
·39 lines (30 loc) · 1001 Bytes
/
sensor_data.php
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
38
39
<?php
header('Access-Control-Allow-Origin: *');
include_once('connection.php');
//$response = file_get_contents("php://input");
//print_r($response);
if(isset($_GET['bin_code']) && isset($_GET['is_bin_present']) && isset($_GET['bin_level']))
{
$bin_code = $_GET['bin_code'];
$is_bin_present = $_GET['is_bin_present'];
$latitude = $_GET['latitude'];
$longitude = $_GET['longitude'];
$bin_level = $_GET['bin_level'];
$stmt = $conn->prepare("INSERT INTO bin_sensor_data(`fk_bin_id`, `is_bin_present`, `latitude`, `longitude`, `bin_level`, `created_time`)
VALUES(:bincode, :isbinpresent, :latitude, :longitude, :binlevel, :creationtime)");
if($stmt->execute(array(
"bincode" => $bin_code,
"isbinpresent" => $is_bin_present,
"latitude" => $latitude,
"longitude" => $longitude,
"binlevel" => $bin_level,
"creationtime" => date('Y-m-d H:i:s'))))
{
echo 'Success';
}
else
{
echo 'NOT Success';
}
}
?>