PHP只发送我的句子中的第一个单词?

时间:2017-06-08 07:40:15

标签: php

我正在开发一个APi,它禁止向一个号码发送短信......这应该是“您已收到移动号码的注册信息。感谢您保持联系”但发送的文字按摩只是第一个单词“你的

这是我的代码

    $message ="Your registration for mobile no has been received. Thank you for staying with MbongoCash";

sendTextMessage("0719401837",$message);

function sendTextMessage($phoneNumber,$data)
{

    $url = "http://121.241.242.114/bulksms/bulksms?username=josy-mbongocash&password=Jofar14&type=0&dlr=1&destination=$phoneNumber&source=MbongoCash&message='$data''";
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($curl);
    curl_close($curl);
    return $response;
}

这是图像。 This is the Image screenshot

2 个答案:

答案 0 :(得分:4)

邮件中的空格会破坏URL。使用urlencode应解决此问题:

$data = urlencode($data);

答案 1 :(得分:0)

尝试用%20替换空格。

$message ="Your registration for mobile no has been received. Thank you for staying with MbongoCash";
$message =str_replace(" ", "%20", $message);
// rest of code.