I am using below curl function for sending SMS.
if i put some spaces in message its not working.otherwise its working

<strong class="highlight">function</strong> sendSMS($mobile, $msg, $sender, $sendPass, $sendID)
    {
        $msg=urlencode($msg);
        $ch = curl_init();
        $url="http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=xxxxx&password=xxxxx&sendername=nix&mobileno=$phone&message=$message";
        //echo $url;
        //$url=urlencode($url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
        //return substr($data,0,1);
    }

Recommended Answers

All 3 Replies

Is the message encoded properly, are the spaces replaced with %20 for example ?

Is the message encoded properly, are the spaces replaced with %20 for example ?

When i echo $url & put $url value in the url its working fine.
I am using trim function for message
$message=trim($_POST);
another thing:its working fine when message has no space i.e mynameisjacob

try $message = urlencode($message); then tack it on the end of your url string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.