| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/iotdatal/ |
Upload File : |
<?php
include 'configconn.php';
include 'opendbconn.php';
//$res = file_get_contents("http://192.168.22.61/1451");
//$res = file_get_contents("http://localhost/csl-ambient/testpage.php");
//$body = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $res);
//$value = explode("<td>", $body);
//$v1=explode("<\/td>", $value[1]);
//$v2=explode("<\/td>", $value[3]);
// $val1=$v1[0];
// $val2=$v2[0];
//$val22=explode("%",$val2);
//$par1=preg_replace("/[^0-9\\.]/i", "", $val1);
//$par22=preg_replace("/\&\#382/", "", $val22[0]);
//$par2=preg_replace("/[^0-9\\.]/i", "", $par22);
$id_node=0;
$temperature=0.0;
$rel_humidity=0.0;
$ir_t=0.0;
$acc_x=0.0;
$acc_y=0.0;
$acc_z=0.0;
$sdata;
/*
if($_GET["sdata"])
{
$sdata=$_GET["sdata"];
}
$sparameter=explode(";",$sdata);
$temperature=$sparameter[0];
$rel_humidity=$sparameter[1];
$ir_t=$sparameter[2];
$acc_x=$sparameter[3];
$acc_y=$sparameter[4];
$acc_z=$sparameter[5];
*/
if($_GET["id_node"])
{
$id_node=$_GET["id_node"];
}
if($_GET["temperature"])
{
$temperature=$_GET["temperature"];
}
if($_GET["rel_humidity"])
{
$rel_humidity=$_GET["rel_humidity"];
}
if($_GET["ir_t"])
{
$ir_t=$_GET["ir_t"];
}
if($_GET["acc_x"])
{
$acc_x=$_GET["acc_x"];
}
if($_GET["acc_y"])
{
$acc_y=$_GET["acc_y"];
}
if($_GET["acc_z"])
{
$acc_z=$_GET["acc_z"];
}
$sqlInsertTask="insert into gprsvalues(temperature,rel_humidity,ir_t,acc_x,acc_y,acc_z) values ('$temperature','$rel_humidity','$ir_t','$acc_x','$acc_y','$acc_z')";
$resultTask = mysql_query($sqlInsertTask);
if($resultTask){
// header('Location: '."index.php");
$url='https://api.thingspeak.com/update?api_key=0X2HHH6Y6SB3JC36&field1='.$temperature.'&field2='.$rel_humidity;
$contents=file_get_contents($url);
if($contents !== false){
echo $contents;
}
} else{
// $message="Greska, upis podataka nije uspeo.";
// header('Location: '."measure_value.php");
}
include 'closedbconn.php';
?>