Is there any way to automatically run PHP script on Hosting web server withour cron?

前端 未结 11 777
别跟我提以往
别跟我提以往 2021-01-13 14:48

I had a script which sends sms alerts everyday. I want it to send automatically send sms by fetching message from database. Can I do it without cron. Is there any other solu

11条回答
  •  野的像风
    2021-01-13 15:19

    You have a couple of options:

    • Emulate cron behavior: In your php code, check if the page was loaded at, or close to, the time you wish to schedule the sendout for, if the messages havent been sent yet, load the script that sends the messages in the background and flag them as sent.

    • As others have suggested, setup a cronjob somewhere else that will execute a script on your server by fetching the url via http (by using wget for example)

提交回复
热议问题