KevinCasoco / waste-disposal-tracking-system

Waste Disposal Tracking System for District 3 of Caloocan City our capstone project.
https://wastedisposaltrackingsystem-2024.com/
1 stars 0 forks source link

implementing-itextmo-sms-api-for-every-users #108

Closed KevinCasoco closed 7 months ago

KevinCasoco commented 8 months ago

// sample code hope it works

public function sendSMS(Request $request) { $apiKey = env('ITEXMO_API_KEY'); $apiSecret = env('ITEXMO_API_SECRET');

$to = $request->input('to'); // Assuming you're passing the recipient's phone number dynamically
$message = $request->input('message');

$response = Http::post('https://www.itexmo.com/php_api/api.php', [
    '1' => '09191234567', // Your iTexMo account number
    '2' => $apiKey, // Your iTexMo API Key
    '3' => $message,
    '4' => $to, // Dynamic recipient's phone number
]);

// Check the response status
if ($response->successful()) {
    // Handle successful response
    return response()->json(['success' => true, 'message' => 'SMS sent successfully']);
} else {
    // Handle failure
    $error_message = $response->body();
    return response()->json(['success' => false, 'error' => $error_message], 500);
}

}

image

need valid id to verify the accounts

KevinCasoco commented 7 months ago

https://app.philsms.com/account

image