<?php
function sendSMS($to, $message) {
    // Your bulkSMSbd.net credentials
    $apiKey = "BfvwrJ2Du5v9tqKROzJ";      // Replace with your actual API key
    $senderId = "8809617625314";   // Replace with your approved sender ID
    
    $url = "https://bulksmsbd.net/api/smsapi";
    $data = [
        "api_key" => $apiKey,
        "senderid" => $senderId,
        "number" => $to,
        "message" => $message
    ];
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
    
    // Optional: Log the response for debugging
    error_log("SMS to $to: " . $response);
    return $response;
}
?>