Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm on a free hosting plan so the cron options are limited. I want my script to run at 23:59 but can't supply the syntax. The closest option they have to what I want is every ten minutes.

What I have tried:

In my code, I'm manually testing like so

$now = new DateTime("now", new DateTimezone("Africa/Lagos"));<br />
if ($now->format ("H:i") == '23:50')) {}<br />


But it never ever runs. If I visit this script's URL from the address bar, it runs seamlessly. If I call file_put_contents() outside the if condition, it runs. Does it mean the server never recognizes the time in the condition?
Posted
Updated 9-Oct-18 8:44am

1 solution

If your cron job setting option is limited then you can call the script with cUrl (as alternative to CRON). Just do a scheduled task on your local machine that executes the cUrl function.
 
Share this answer
 
Comments
nmeri17 9-Oct-18 15:09pm    
This assumes my local machine is always on round the clock which is impossible due to factors majorly electric power. Thank you for your effort.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900