LINE Notify After Submit form

I try to find php script to using LINE Notify. I'm stuck with a code issue and need some expert advice.

I've tried insert code below in php script, but it's not working.

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$message = isset($_POST['message']) ? $_POST['message'] : '';

// LINE Notify
$token = 'xxxx'; // Token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://notify-api.line.me/api/notify");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer ' . $token
));
curl_setopt($ch, CURLOPT_POSTFIELDS, 'message=' . urlencode($message));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// error check
if (!$response) {
echo 'Error: ' . curl_error($ch);
} else {
echo 'Message sent! Response: ' . $response;
}
}

https://notify-bot.line.me/en/

Could you please take a look at my code and suggest any fixes? Your help would be really appreciated.

Replies are visible only to logged in members with an active subscription.