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.


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

// LINE Notify
$token = 'xxxx'; // Token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
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);

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

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.