简体   繁体   中英

update page in PHP in a specific time

Hi I have the following code which can send text messages according to the date of birth and hour but the page has to be updated manually i would like it to update at a specific time, for example every day at 06:00 am. There a way in PHP?

$deviceID = 12345;
$number = $resultado;
$message = 'Happy Birthday man!!';
$options = [
'send_at' => strtotime(date('Y-'.$birth_dates.' 09:42:00',time())),
'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the  message is not yet sent
];
$result = $smsGateway->sendMessageToNumber($number, $message,  $deviceID,$options);
?>

This should be a cronjob, not a page. You can set when the task will be executed, so your sms will be sent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM