Untitled

 avatar
unknown
plain_text
4 months ago
945 B
3
Indexable
<?php

$port = 'COM5'; // Example port, replace with actual port
$guardianNumber = '09639437316'; // Replace with actual phone number

// Path to your compiled C# executable
$exePath = realpath('../SendSMSApp.exe'); // Adjust the path as needed

if (!$exePath) {
    die("Error: C# executable not found.");
}

// Escape each argument
$escapedPort = escapeshellarg($port);
$escapedNumber = escapeshellarg($guardianNumber);
$escapedExePath = escapeshellarg($exePath);

// Build the command
$command = "{$escapedExePath} {$escapedPort} {$escapedNumber}";

// Execute the command and capture the output and exit code
exec($command, $output, $exitCode);

// Display the result
if ($exitCode === 0) {
    echo "Message sent successfully!<br>";
    echo "Output: " . implode("<br>", $output);
} else {
    echo "Failed to send the message. Exit Code: $exitCode<br>";
    echo "Output: " . implode("<br>", $output);
}
?>
Editor is loading...
Leave a Comment