-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
34 lines (27 loc) · 943 Bytes
/
server.php
File metadata and controls
34 lines (27 loc) · 943 Bytes
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
<?php
require_once "lib/nusoap.php";
function insertMeasure($sensorID, $date, $value) {
$sql = "insert into measure(msre_sensor_id, msre_data, msre_value) values($sensorID,$date,$value)";
$host = "mysql.hostinger.com.br";
$database = "u191786021_ws";
$user = "u191786021_aline";
$pass= "weather";
// Create connection
$con = mysql_connect($host,$user,$pass) or print (mysql_error());
mysql_select_db($database, $con) or print(mysql_error());
$result = mysql_query($sql, $con);
mysql_close($con);
return "success";
}
$server = new soap_server();
$server->configureWSDL("server", "urn:server");
$server->register("insertMeasure",
array("sensorID" => "xsd:string","date" => "xsd:string","value" => "xsd:string"),
array("return" => "xsd:string"),
"urn:server",
"urn:server#insertMeasure",
"rpc",
"encoded",
"Insert data into table");
$server->service($HTTP_RAW_POST_DATA);
?>