0

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');
  • It looks like you just want to call a foreign URL from your PHP script. See here for a starting point how to do this: https://stackoverflow.com/questions/9802788/call-a-rest-api-in-php or https://stackoverflow.com/questions/7999323/how-to-access-restful-api-via-php – GreenTurtle Mar 17 '20 at 08:04
  • It was not helpful I already tour of this thread. – Shubham Singh Mar 17 '20 at 12:17
  • If you want a more specific help your question needs to be more specific. What is the error you get? Why the solution in the links mentioned above is not an option for you? – GreenTurtle Mar 18 '20 at 13:05
  • I am not seeing any error but this is not working.. – Shubham Singh Mar 19 '20 at 02:47

0 Answers0