We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,503 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Unable to send sms using Ozeking - Smsgateway

                                echo "<form action='' id='customForm' method='post'>";
                                echo "<div>";
                                    $mobile = $_SESSION['mobile'];
                                    echo "<label for='name'>From : $mobile</label>";
                                echo "</div>";
                                echo "<div>";
                                    echo "<label for='name'>Sender Mobile number</label>";
                                    echo "<input type='text' name='recipient' id='mobile' class='error'>";
                                    echo "<span id='nameInfo' class='error'> Mobile number must contain only 10 digits</span>";
                                echo "</div>";
                                echo "<div>";
                                    echo "<label for='email'>Message &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;your sms balance : {$udata['sms']}</label>";
                                    echo "<textarea onKeyDown='limitText(this.form.smessage,this.form.countdown,140);' onKeyUp='limitText(this.form.smessage,this.form.countdown,140);' maxlength='140' name='message' id='message'></textarea>";
                                    echo "<span id='emailInfo' class='error'> Message boy supports 140 charecters :P</span>";
                                echo "</div>";
                                echo "<div>";
                                echo "You have <input readonly type='text' id='limited' name='countdown' size='3' value='140'> characters left.</font>";
                                echo "</div>";
                                    echo "<div>";
                                        echo "<input type='submit' value='Send' name='send' id='send'>";
                                    echo "</div>";
                            echo "</form>";

Receiving in POST Method:

        if(isset($_POST["send"]))
                            {
                                $recipient = $_POST["recipient"];
                                $message = $_POST["message"];
                                if($recipient == "" || $message == "")
                                {
                                    echo "<div cloass='error'>are you kidding ? enter something to act</div>";
                                }
                                else
                                {
                                    $recipient = $_POST["recipient"];
                                    $message = $_POST['message'];

                                    $gateway = "http://127.0.0.1:8080/api?action=sendmessage&username=admin&password=admin&recipient=NNNNN&messagetype=SMS:TEXT&messagedata=MMMMM";
                                    $gateway = str_replace("NNNNN", $recipient, $gateway);
                                    $message = str_replace("", "+", $message);
                                    $gateway = str_replace("MMMMM", $message, $gateway);

                                    $r= new HttpRequest($gateway, HttpRequest::METH_POST);
                                    try
                                    {
                                        $r->send();
                                        echo "<div cloass='error'>Message sent to : $recipient</div>";
                                    }
                                    catch (HttpException $ex)
                                    {
                                        echo $ex;
                                    }
                                }
                            }

Am not able to send sms using this script, can any one find the error thanks in advance..

2
Contributors
1
Reply
2 Days
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
rayidi
Junior Poster in Training
83 posts since May 2011
Reputation Points: 13
Solved Threads: 2
Skill Endorsements: 0

You should write more information, you get the data from the form? You still display the correct data after you do str_replace()? Have you tried to get response code? Right after r->send(); write:

try
{
    $r->send();
    echo $r->getResponseCode(); # so you know if the request reaches the gateway
    echo "<div cloass='error'>Message sent to : $recipient</div>";
}
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
Question Answered as of 11 Months Ago by cereal

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0977 seconds using 2.68MB