I am using an api (for sending sms) for which I am using curl request in my custom function in a controller. we are calling this api using cron job by calling custom function (I am using currently wget for this).
When cron runs it hits that API multiple times and users get same sms multiple times.
And when I run that url (custom function url) manually in browser then user gets sms only once.
Cron runs one time in a day
Cron code :
5 18 * * * wget -O - https://www.siteurl.com/sms_notifications/seller
Php script :
<?php
$url="http://api.textlocal.in/send/";
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData,
));
$output = curl_exec($ch);
if(curl_errno($ch)) {
//echo 'error:' . curl_error($ch);
return false;
} else {
curl_close($ch);
$this->JobsModel->updateSMSNotificationStatus($smsnotificationid,'yes');
return true;
}
?>
Is this issue because I have used wget and do I need to switch to curl or php and why.