<?php
// Correct API URL
$apiUrl = "https://whatsapp.speedcomwifi.co.ke/manager/send-message";

// Your API token
$token = "BE2F2A2F19C5-42A4-8BCC-29B207F492F5";

// Recipient phone number (international format)
$to = "254718167262";

// Message text
$message = "Hello! This is a test message from Evolution API.";

// Prepare data
$data = [
    "number" => $to,
    "message" => $message
];

// Initialize cURL
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $token",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

// Execute request
$response = curl_exec($ch);
if(curl_errno($ch)){
    echo 'Request Error:' . curl_error($ch);
}
curl_close($ch);

// Output API response
echo $response;
?>
