0

I have to setup a cron webjob in the ovh platform. The script to call will be in a php file 'cron.php'.

I need to execute 2 codeigniter functions, the links will be like this :

http://example.com/index.php/process/send1/

http://example.com/index.php/process/send2/

So i need to execute those links in 'cron.php', do you have any idea how to achieve this ?

Thank you in advance

Sparky
  • 98,165
  • 25
  • 199
  • 285
spanpa
  • 1
  • 1
  • 1
  • 6

2 Answers2

0

You can't call the codeigniter functions directly. Instead you could make a request to each URL to run the function code. You could use the php exec function to run the "wget" command on them to send a request.

In cron.php:

exec('wget http://example.com/index.php/process/send1/');
exec('wget http://example.com/index.php/process/send2/');

If this fails because of PHP not having permissions to execute the command then try file_get_contents() or curl.

which1ispink
  • 3,018
  • 3
  • 14
  • 24
0

I have setup so many crons in my live projects with this method http://www.asim.pk/2009/05/14/creating-and-installing-crontabs-using-codeigniter/

khushi
  • 178
  • 2
  • 10