Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.152.168
<?php
include ("database.php");
include("sendsmsbulk.php");
$query = "select fenttype,group_concat(concat('91',fmobileno)) as mobilenos, fmessage
from tmpsms
where ifnull(fstatus, 'F') = 'F'
and fmobileno is not null
group by fenttype";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
$username = 'logisyhttp';
$password = 'Logis986';
$from = 'LOGINF';
$category = 'bulk';
if($count >0)
{
while($row = mysqli_fetch_assoc($result))
{
$rgBigArr = explode(',', $row['mobilenos']);
$rgSmallArr = array_chunk($rgBigArr,100);
$text = $row['fmessage'];
foreach($rgSmallArr as $key => $value)
{
$strTo = implode(',', $value);
$response = sendsmaapibulk($username,$password,$from,$strTo,$text,$category);
$rgExpAmp = explode('&', $response);
array_walk($rgExpAmp, function($val,$key) use(&$final){
list($key, $value) = explode('=', $val);
$final[$key] = $value;
});
$errorcode = explode(',', $final['errorcode']);
$mobnos = explode(',', $final['seqno']);
$rgInsert = array();
$rgTrimedMobs = array();
for($i = 0; $i < count($mobnos);$i++)
{
$rgInsert[] = "('".substr($mobnos[$i],2,11)."','".$errorcode[$i]."','".$final['guid']."','".$row['fenttype']."', DATE_FORMAT(NOW(),'%Y-%m-%d'), DATE_FORMAT(NOW(),'%T'))";
$rgTrimedMobs[$i] = substr($mobnos[$i],2,11);
}
$strInsertQuery = "insert into smslog(fmobileno, freasoncode, fguid, fenttype, fackdate, facktime) values".implode(',',$rgInsert);
$result1 = mysqli_query($conn,$strInsertQuery);
$srtImplodedMobs = implode("','",$rgTrimedMobs);
$strUpdateQuery = "update tmpsms set fstatus = 'T' where fenttype = '{$row['fenttype']}' and fmobileno in ('{$srtImplodedMobs}')";
$result2 = mysqli_query($conn,$strUpdateQuery);
}
}
}
?>
|