if (!isset($ndata["{$user_id}"])) { $ndata["{$user_id}"] = array(); $ndata["{$user_id}"]['mobile_number'] = $row['mobile_number']; $ndata["{$user_id}"]['first_name'] = $row['user_first_name']; $ndata["{$user_id}"]['last_name'] = $row['user_last_name']; $ndata["{$user_id}"]['company_ref_id'] = $row['company_ref_id']; $ndata["{$user_id}"]['data'] = array(); } $arr = array(); $arr['account_name'] = $row['account_name']; $arr['debit_amount'] = $row['debit_amount'] * 1; $ndata["{$user_id}"]['data'][] = $arr; } dump($ndata); include_once '../../Classes/Telenor.php'; $telenor = new Telenor('923458219245', '7264'); //$telenor->setMask('NEXEXCEL'); $sms_template_1 = "Dear %s %s, You have %d Cheque as of %s for a total of %s %s from\n"; $sms_template_2 = "%s - %s %s\n"; foreach ($ndata as $user_id => $data) { $currencyCode = getCurrencySymbol($data['company_ref_id']); $total = (double) 0; $sms = ""; foreach ($data['data'] as $row) { $total += $row['debit_amount']; $sms .= sprintf($sms_template_2, $row['account_name'], $currencyCode, number_format($row['debit_amount'])); } $sms = trim(sprintf($sms_template_1, $data['first_name'], $data['last_name'], count($data['data']), date("d-M-y"), $currencyCode, number_format($total)) . $sms); $ret = $telenor->sendSms($data['mobile_number'], $sms); if ($ret === false) { $error = $telenor->getError();
<?php ob_start(); echo "</pre>"; chdir(dirname(__FILE__)); include_once '../../Classes/Telenor.php'; $telenor = new Telenor('923458219245', '7264'); //$telenor->setMask('NEXEXCEL'); $sms_template_1 = "Dear %s %s, You have %d Cheque as of %s for a total of Rs. %s\n"; $sms = sprintf($sms_template_1, 'Imran', 'Zahid', 5, date("d-M-y"), '12,345'); $ret = $telenor->sendSms('+923458250386', $sms); if ($ret === false) { $error = $telenor->getError(); print_r($error); } echo "</pre>"; $out = ob_get_contents(); ob_end_clean(); $fp = fopen('sms_cron.htm', 'w'); fwrite($fp, "<html><head><title>SMS CRON</title></head><body>"); fwrite($fp, $out); fwrite($fp, "</body></html>"); fclose($fp);