prepare($sql); $stmt->execute(); $communications = $stmt->fetchAll(PDO::FETCH_ASSOC); //ITERATE OVER RESULTS foreach ($communications as $communication){ $to = $communication['email']; include './assets/mail/email_template_firmware.php'; send_mail($to,$subject,$message,'',''); //UPDATE COMMUNICATION RECORD $sql = 'UPDATE communication SET send_indicator = 0, send = ? WHERE rowID = ?'; $stmt = $pdo->prepare($sql); $stmt->execute([$date,$communication['rowID']]); } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // END FIRMWARE COMMUNICATION TO END-USER ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // getUserkey ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ $token =''; $data = json_encode(array("username" => interface_user, "password" => interface_pw), JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/authorization', $payload); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = '400';} if ($responses === 'NOK' || $responses === '400'){ //Not allowed http_response_code(403); exit; } else { // Store data in session $token = $responses->userkey; } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // close Contracts ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ closeContract(); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Machine learning ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ $total_measurement = traintotalMeasurement(); $total_results = statisticalAnalyses($total_measurement); storeMeasurementProduct($total_results, $token); storeMeasurementEquipment(''); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // GeoUpdate ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ geolocationUpdate($token); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // EXIT ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ http_response_code(200); exit;