tags:

views:

75

answers:

3

The way my site is setup, I need to manually visit two URLs to trigger the mail system. One URL compiles a list of emails, another sends them off.

I'd like to automate this using a cronjob, but here's the problem. I am using the Kohana framework and I don't think copy pasting the code within the controllers will work.

The easiest way to accomplish what I am doing is to have the two URLs visited every 5 minutes or so. Is it possible to "visit" (for a lack of better word) sites in PHP?

+6  A: 

Yes, if you just use file_get_contents or access it by cURL, it would be considered "visited" as it will simply create a GET request.

file_get_contents($url1);
file_get_contents($url2);
shamittomar
A: 

If you just want to 'visit' a web site you could retrieve it via file_get_contents(), or if you have the curl extension installed you could fire up a curl request at your URLS.

Hamza
Looks like shamittomar beat me to it :)
Hamza
A: 

If you are running the cron job on the same machine as the server you can call Kohana on the command line using this syntax.

/usr/bin/php index.php --uri=controller/action

Replace controller/action with the route you wish to call.

Note that any $SERVER variables are not defined when you invoke Kohana in this manner.

Gerry