යාලුවනේ මම SMS API gateway එකක් හදනවා (dialog ලගේ තම API එක) දැනට database එකෙන් customers ලාට dynamic sms යවන්න පුළුවන් .....
එත් අවුල තියෙන්නේ message එකේ space තිබ්බොත් sms වෙන්නේ පලවෙනි word එක විතරයි
මෙන්න code එක
<?php
require_once(dirname(__FILE__)."/classes/db-connection.php");
$obj = new dbconnection();
$con = $obj->getcon();
$id_sms=$_POST["id_sms"];
$today=date("Y/m/d/h");
$pass="141**************";
$sqlstatesms="SELECT * FROM msgtable WHERE id_sms ='$id_sms' ;";
$resultsms=mysql_query($sqlstatesms,$con) or die ("SQL Error".mysql_error());
$recordsms=mysql_fetch_array($resultsms);
$msg_sms=$recordsms["msg"]; // get the msg from db
$sqlstate="SELECT * FROM customer_reg_sms WHERE cuscontactnu1 LIKE '7%' ;";
$result=mysql_query($sqlstate,$con) or die ("SQL Error".mysql_error());
$rownumber=mysql_num_rows($result);
while($record=mysql_fetch_array($result)){
$cusid=$record["customerid"];
$bal=$record["balance"];
$lp=$record["lastpayment"];
$getp=$record["cuscontactnu1"];
$pnumber ="94".$getp;
$msg=$msg_sms." ".$bal." and your last payment is".$lp."***xxxxxxxxxxxxxxxxxxxx (011-5******)***"; //set the msg
// echo $y = "https://cpsolutions.dialog.lk/index.php/cbs/sms/send?destination=".$pnumber."&q=".$pass."&message=".$msg; ?> </br><?php
when echo this "$y" out come will be
https://cpsolutions.dialog.lk/index.php/cbs/sms/send?destination=94778119027&q=14181866758&message=Dear customer your due amount is 2000.00 and your last payment is 4500.00***xxxxxxxxxxxxx(011-xxxxxxx)***
If I copy and paste the above URL on address bar (with correct password) complete SMS send successfully
//$resultstu =file_get_contents("$y");
above code I used to get the response value from the dialog API gateway
and it gives correctly ,,,but sms send with the first word only in this..only "Dear"
}
$obj->close();
එත් අවුල තියෙන්නේ message එකේ space තිබ්බොත් sms වෙන්නේ පලවෙනි word එක විතරයි
මෙන්න code එක
<?php
require_once(dirname(__FILE__)."/classes/db-connection.php");
$obj = new dbconnection();
$con = $obj->getcon();
$id_sms=$_POST["id_sms"];
$today=date("Y/m/d/h");
$pass="141**************";
$sqlstatesms="SELECT * FROM msgtable WHERE id_sms ='$id_sms' ;";
$resultsms=mysql_query($sqlstatesms,$con) or die ("SQL Error".mysql_error());
$recordsms=mysql_fetch_array($resultsms);
$msg_sms=$recordsms["msg"]; // get the msg from db
$sqlstate="SELECT * FROM customer_reg_sms WHERE cuscontactnu1 LIKE '7%' ;";
$result=mysql_query($sqlstate,$con) or die ("SQL Error".mysql_error());
$rownumber=mysql_num_rows($result);
while($record=mysql_fetch_array($result)){
$cusid=$record["customerid"];
$bal=$record["balance"];
$lp=$record["lastpayment"];
$getp=$record["cuscontactnu1"];
$pnumber ="94".$getp;
$msg=$msg_sms." ".$bal." and your last payment is".$lp."***xxxxxxxxxxxxxxxxxxxx (011-5******)***"; //set the msg
// echo $y = "https://cpsolutions.dialog.lk/index.php/cbs/sms/send?destination=".$pnumber."&q=".$pass."&message=".$msg; ?> </br><?php
when echo this "$y" out come will be
https://cpsolutions.dialog.lk/index.php/cbs/sms/send?destination=94778119027&q=14181866758&message=Dear customer your due amount is 2000.00 and your last payment is 4500.00***xxxxxxxxxxxxx(011-xxxxxxx)***
If I copy and paste the above URL on address bar (with correct password) complete SMS send successfully
//$resultstu =file_get_contents("$y");
above code I used to get the response value from the dialog API gateway
and it gives correctly ,,,but sms send with the first word only in this..only "Dear"
}
$obj->close();
Last edited:
