0

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);
    }

Edited by pyTony: fixed formatting

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by ddymacek
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.