skip to Main Content

I intergraded the SMS gateway in my Laravel project I want to sms to the client registration link through SMS but I tried the same way it’s going but can’t click. And mainly I plan to take the client’s WhatsApp number but In WhatsApp message is coming but can’t click.

Please help me fix this issue.

$smsMsg = notifications::where('sms_subject','Student Register Link')->first();

        if($request->stud_nic!="")
        {
            $student = students::where('st_nic', $request->stud_nic)->first();

            $studName = $student->st_fname;
            $phone = $student->st_phone;
            $studNic = $request->stud_nic;

            $nic = Hash::make($studNic[0]);
            $link = "http://127.0.0.1:8000/StudentCount/".$nic;
            $addName = str_replace("{{name}}",$studName,$smsMsg->message);
            $addNic = str_replace("{{link}}",$link,$addName);
            $newMsg = urlencode($addNic);

            $api = "https://sms-gateway-api.php?key=".$key."&acc=".$acc."&type=".$type."&phone=".$phone."&text=".$newMsg;
            $response = file_get_contents($api);
        }

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found the issue and I fixed it. The issue was I used the IP address that will disable the link when using the IP. After I changed into the domain it's working.

    $smsMsg = notifications::where('sms_subject','Student Register Link')->first();
        
                if($request->stud_nic!="")
                {
                    $student = students::where('st_nic', $request->stud_nic)->first();
        
                    $studName = $student->st_fname;
                    $phone = $student->st_phone;
                    $studNic = $request->stud_nic;
        
                    $nic = Hash::make($studNic[0]);
                    $link = "http://testing.com/StudentCount/".$nic;
                    $addName = str_replace("{{name}}",$studName,$smsMsg->message);
                    $addNic = str_replace("{{link}}",$link,$addName);
                    $newMsg = urlencode($addNic);
        
                    $api = "https://sms-gateway-api.php?key=".$key."&acc=".$acc."&type=".$type."&phone=".$phone."&text=".$newMsg;
                    $response = file_get_contents($api);
                }
    

  2. Links, phone numbers, etc are usually detected by your messaging application (they parse the text, and if it feels its a link/phone number, it makes them clickable), and text messages are usually just plaintext. There is no standard way to format them.

    So most likely your SMS application is not detecting it. Try sending it to some other device, maybe it might detect the link. But there’s no guarantee it will work on every SMS application

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search