<?php

$token = 'EAFwy9fCHiC8BRrAnF5rZBvwWuKNGcLVlfZBlRzKJjQT33XaPE6ZA5cUdUCplB4Hy5Parx0fnqS8TvqEMKvKyoDVmYf2AyXQ4xs3f4bw6ZBCZCZCbARMhbp0IRWIJxzvzxESRa60S9X7UPs5ZAsLstuwyKPmWl4JGymXYs0ZCaxywPbM9X1w7mfoQT42hActZBRQZDZD';
$phoneNumberId = '1105292156001304';

$data = [
    "messaging_product" => "whatsapp",
    "to" => "94767668161",
    "type" => "text",
    "text" => [
        "body" => "EDEN RMS WhatsApp test successful"
    ]
];

$ch = curl_init("https://graph.facebook.com/v22.0/$phoneNumberId/messages");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $token",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode($data)
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;