SMS Sending Function not works in PHP-ThrowExceptions

Exception or error:

I am trying to make sms sending functions in php but it not works from my ends error = env function I can use file_get_contents but this is not good idea to achieve this. I want to learn through bugs and mistakes. So stackoverflow is best for me as I believe.
Please now let me know how I make this correct.
Where I am doing mistake please correct me.
Thank you very much.

function sendMessage($route, $sender, $mobile, $message) {
    $message = urlencode($message);

    $url = sprintf("https://www.sms4india.com/send_sms?api_token=%s&route=%s&senderid=%s&number=%s&message=%s",
    env('MY_API_HERE'), $route, $sender, $mobile, $message);

    return $output;
}

sendMessage('4', 'WHTSAP', 'MOBILE_NO', 'HELLO WORLD');
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *