T
T
TopdiR2012-09-21 10:44:44
PHP
TopdiR, 2012-09-21 10:44:44

How to run PHP script daily?

I have the following task:

We have written a script that creates new posts for WordPress by pulling data from a database that comes in via FTP from outside. The script is launched by entering the address of a hidden page into the browser line (for example, "_www.nashwebsite.com/stranica-id=1000").

Now we are scratching our heads how to make this script run itself daily (without anyone's intervention).

I thought that there must already be some kind of service (perhaps even a paid one) that can visit the page at the specified time once a day. But alas, I can't find one.

Answer the question

In order to leave comments, you need to log in

9 answer(s)
R
rakot, 2012-09-21
@rakot

Don't have Cron on your hosting?

S
Sergey Shirokov, 2012-09-21
@kurokikaze

Add its execution to cron . If adding just via the command line interpreter ( php имя_скрипта), be aware that the environment variables may not be the same as usual. Perhaps it would be easier to add a curl call to cron with the quiet option and the address of the desired page.

V
Vlad Zhivotnev, 2012-09-21
@inkvizitor68sl

curl www.nashwebsite.com/stranica-id=1000 -O /some/file.log 2>/dev/null
Plug into cron.

A
Andrew, 2012-09-21
@freiman

cron+wget?

A
Anton_from_Amber, 2012-09-21
@Anton_from_Amber

If you don't care where to call the script from (from the local machine or external environment), then set up the task scheduler on an always-on machine with an Internet connection.
Although in such cases a scheduler on a web server (cron - *NIX, a scheduler on windows) is the most correct solution.

A
anathem, 2012-09-21
@anathem

+1 to all.
And if it’s just hosting, and not servers at all, cron is usually placed in the control panel as a separate bag-page. In direct admin it is called "Task Scheduler". Once a day, you need to put "* /
24" in the column "hour"

T
TopdiR, 2012-09-24
@TopdiR

Since we just had to follow the link to run the script, Cron is not very suitable for us, but still very grateful to everyone!
There is a Chrome plugin that does this. There is also a Windows Task Scheduler which can also do this.
In general, I have not yet found another solution so that I can do without intervention.

W
Wott, 2012-09-27
@Wott

They already wrote about crons here.
And WP can also run internal scheduled tasks itself - once an hour, once or twice a day.

A
ArduinoGirl, 2018-01-24
@ArduinoGirl

There is such a service: Cron-Job.ru , moreover, Russian-language and free.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question