SMS中未显示“ <”和“>”

时间:2019-09-12 09:36:47

标签: php urlencode sms-gateway

我正在尝试通过PHP发送短信-Laravel。 SMS的发送效果非常好,但是正在从消息中删除<>的符号。这是我的代码

控制器

public function login(Request $request)
{
    $number = $request->get('number');
    $otp = rand(1000,9999);
    $client = Client::query()->where('number',$number)->exists();

    if($client){
        $message = "<#> Your otp verification code is ".$otp."\nLet's get started your journey with BodLai!!!\nPlease don't share this code with others fdjweisjdfl";
    }else{
        Client::query()->create($request->all());
        $message = "<#> Your otp verification code is ".$otp."\nLet's get started your journey with BodLai!!!\nPlease don't share this code with others fdjweisjdfl";
    }

    $this->verificationSMS($number,$message);

    return ['otp_pin'=>$otp];
}

public function verificationSMS($number,$message)
{
    $api_key = "[api_key]";
    $senderid = [sender_id];
    $URL = "http://esms.mimsms.com/smsapi?api_key=".$api_key."&type=text&contacts=".$number."&senderid=".$senderid."&msg=".urlencode($message);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$URL);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_POST, 0);

}

这些代码工作正常。但是我收到的短信中没有<>

示例:

  

#您的otp验证码是1984   让我们开始与BodLai的旅程吧!!!   请不要与其他人分享此代码。fdjweisjdfl

我的问题是,如何在短信中发送<>登录?我已经尝试使用UNICODE和HEX CODE来代替这些符号,但是它们都不起作用。

0 个答案:

没有答案