codeigniter cron job with http access
- by user1313850
Sorry if this is a duplicate question...I've searched around and found similar advice but nothing that helps my exact problem. And please excuse the noob questions, CRON is a new thing for me.
I have a codeigniter script that scrapes the html DOM of another site and stores some of that in a database. I'd like to run this script at a regular interval. This has lead me to looking into cron jobs.
The page I have is at myserver.com/index.php/update
I realize I can run a cron job with curl and run this page. If I want to be a bit more secure I can put a string at the end like:
myserver.com/index.php/update/asdfh2784fufds
And check for that in my CI controller.
This seems like it would be mostly secure, but doesn't seem like the "right" way to do things.
I've looked into running CI from the command line, and can execute basic pages like:
php index.php mycontroller
But when I try to do:
php index.php update
It doesn't work. I suspect this is because it needs to use HTTP to scrape the DOM of the outside page.
So, my question:
How do I securely run a codeigniter script with a cron job that needs HTTP access?