This code is echo error message even if its correct!
The problem with this code is either the sending SMS has been sent successfully or NOT successfully will echo for me the same message.
Code:
<?php
$baseurl = "XXXX";
$username = urlencode("XXXX");
$password = urlencode("XXXX");
$mobile = urlencode("6".$_POST['mobile']);
$message = urlencode($_POST['message']);
$sender = urlencode($_POST['sender']);
$type = urlencode("1");
$url = $baseurl."/websmsapi/ISendSMS.aspx?username=".$username."&password=".$password.
"&mobile=".$mobile."&message=".$message.
"&sender=".$sender."&type=".$type;
// do sendmsg call
$ret = fetchURL($url);
$send = split(":",$ret);
if ($send[0] == "ID") {
// Message was submitted to gateway successfully
echo ($ret);
echo "Your Message has been sent successfully man!";
}
else {
// There was an ERROR
echo ($ret);
echo "OMG. You made an Error man!. Go back and check your staff!!";
}
?>
I am sure the problem in IF ELSE but I could not solve it.
Any help please?
Re: This code is echo error message even if its correct!
There's no such PHP function as fetchURL().
Note: split() is a deprecated function. You should be using explode() instead.