message != ""){ error_log($web_result); // Push to Matrix $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$web_hook_room); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('secret' => $web_hook_secret, 'message' => "Error on the data warehouse"))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $result = curl_exec($ch); curl_close($ch); exit(); }else{ foreach($json_object->data->transactions as $query) { $result = mysqli_query ( $connect, $query->argument ); $records_inserted = $records_inserted +1; } // Push to Matrix $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$web_hook_room); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('secret' => $web_hook_secret, 'message' => "Data warehouse inserted ".$records_inserted." queries"))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $result = curl_exec($ch); curl_close($ch); } }catch (Exception $e) { $error_message = 'Exception Message: ' .$e->getMessage(); error_log($error_message); error_log($web_result); // Push to Matrix $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$web_hook_room); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('secret' => $web_hook_secret, 'message' => "Error on the data warehouse"))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $result = curl_exec($ch); curl_close($ch); } }else{ echo '{ "message": "Invalid post variables", "data": {}}'; } ?>