954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unable to send sms using Ozeking - Smsgateway

echo "";
echo "";
$mobile = $_SESSION['mobile'];
echo "From : $mobile";
echo "";
echo "";
echo "Sender Mobile number";
echo "";
echo " Mobile number must contain only 10 digits";
echo "";
echo "";
echo "Message                                                                                                                                                                      your sms balance : {$udata['sms']}";
echo "";
echo " Message boy supports 140 charecters :P";
echo "";
echo "";
echo "You have characters left.";
echo "";
echo "";
echo "";
echo "";
echo "";


Receiving in POST Method:
______________________________________________________________________________________
if(isset($_POST["send"]))
{
$recipient = $_POST["recipient"];
$message = $_POST["message"];
if($recipient == "" || $message == "")
{
echo "are you kidding ? enter something to act";
}
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 "Message sent to : $recipient";
}
catch (HttpException $ex)
{
echo $ex;
}
}
}

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

krishwebdesigne
Light Poster
27 posts since May 2011
Reputation Points: 14
Solved Threads: 1
 

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
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: