tags:

views:

43

answers:

2

I have set up the necessary Models and the web interface to view them via CakePHP.

I have a script that reads emails from a POP3 box, parses out certain information.

I'd like to use the CakePHP models I have to find existing/create new records, based on information that my email script is parsing out, and save them... essentially using the convenience of CakePHP models, but via cron or php on the shell, rather than from a web-accessible controller.

Is this somewhat easy to accomplish? How can I do that?

+1  A: 

CakePHP has built-in support for driving command-line tasks.

I'd suggest following along with the manual there, and if you run into trouble, come back with more specific questions.

timdev
Agreed. Create an EmailShell that $uses any models you need - should just be a case of copying relevant parts of your script into some shell methods (eg. you would call EmailShell::import() with `cake email import`).
deizel
@deizel, that made it a beat clearer, as I had looked through the docs in question but wasn't sure how it applied. Thanks!
anonymous coward
A: 

In older versions you should be able to 'bootstrap' CakePHP and run from the commandline. See this for more information.

Ropstah