This commit is contained in:
PaulVua
2025-01-09 17:52:45 +01:00
parent c95bc3d987
commit 05c54cf6d0

View File

@@ -99,6 +99,32 @@ if ($type == "sara_connectNetwork") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ' . $port . ' ' . $networkID . ' ' . $timeout; $command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ' . $port . ' ' . $networkID . ' ' . $timeout;
$output = shell_exec($command); $output = shell_exec($command);
echo $output; echo $output;
#save to config.json
$configFile = '/var/www/nebuleair_pro_4g/config.json';
// Read the JSON file
$jsonData = file_get_contents($configFile);
// Decode JSON data into an associative array
$config = json_decode($jsonData, true);
// Check if decoding was successful
if ($config === null) {
die("Error: Could not decode JSON file.");
}
// Update the value of SARA_R4_networkID
$config['SARA_R4_neworkID'] = $networkID; // Replace 42 with the desired value
// Encode the array back to JSON with pretty printing
$newJsonData = json_encode($config, JSON_PRETTY_PRINT);
// Check if encoding was successful
if ($newJsonData === false) {
die("Error: Could not encode JSON data.");
}
// Write the updated JSON back to the file
if (file_put_contents($configFile, $newJsonData) === false) {
die("Error: Could not write to JSON file.");
}
echo "SARA_R4_networkID updated successfully.";
} }
#SET THE URL for messaging #SET THE URL for messaging