tim schreef:Gebruik je een Raspberri PI?
Mijn test omgeving zit op een Raspberry PI en mijn Produktie op een Synology NAS.
Grtz,
Henk.
tim schreef:Gebruik je een Raspberri PI?
henkdejonge schreef:Hi rtenklooster,
IK heb een koppeling naar mijn lokale database... Dus ben eigenlijk wel nieuwsgierig naar de scripts die jij gebruikt...
Grtz,
Henk
Gebruik:
execKAKU(1,On);
function execKAKU($n, $v){
$key = getKey();
$cmd = "NewKAKUSend ".$n.",".$v.";";
$command = str_replace(" ","%20",$cmd);
$url ="http://YOUR.NODO.IP.ADDRESS/?event=$command&key=$key";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Nodo Web App");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_PORT, 6636);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,5);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function getKey(){
// Get nodo id / key
# Connect to database
$host = "localhost";
$dbname = "nododom_webappdb";
$user = "db_user";
$pass = "db_pass";
# MySQL with PDO_MYSQL
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$statement = $db->prepare("SELECT `cookie` FROM `nodo_tbl_users` WHERE `id` = 2;");
$statement->execute();
// Count number of rows:
$cookie = $statement->fetch(PDO::FETCH_ASSOC)[cookie];
$key = md5($cookie.":nodo_password");
return $key;
}
Keer terug naar Nodo toepassingen
Gebruikers in dit forum: Geen geregistreerde gebruikers. en 1 gast