Automatic PHP Function

4

I need every day, the system send shipping requests to the post office. How can I do this automatically, without needing a user to load the page or anything?

I would use the same logic of doing something automatically without user interaction (without having to do something, open some page or something) in other things, I did not find anything like it until now.

Is it possible to do this with PHP?

    
asked by anonymous 05.04.2016 / 19:35

2 answers

4

cron jobs / cron job,

How it works:

Create a php file that performs the function you need, and when you open it in http it will execute what you have programmed, now it only needs something automatic to open the file for you, so host and use the resources of hosting, in your hosting configure the cron tasks to run it from time to time, Windows has the native function but can not remember where, linux is called cron job I think. Hosting Support will help you to use there, it's a setting in the control panel itself.

    
05.04.2016 / 19:40
1

Use CRON !

Making it clear, CRON is like a person who will join the link that you program from time to time.

My tip for you is to use a hosting that is Linux, since most have CRON . An example configuration to run a script:

Minuto: *
Hora: *
Dia: *
Mês: *
Ano: *

Comando: curl http://www.meusite.com.br/script_a_executar.php

With this command CRON will run script_a_executar.php every 1 minute.

If you want to schedule 1 time per day:

Minuto: 0
Hora: 0
Dia: *
Mês: *
Ano: *

Comando: curl http://www.meusite.com.br/script_a_executar.php

Search how to configure CRON , so you'll know how to set the time you need.

    
05.04.2016 / 19:51