ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Expression Engine Cron Job and Channel API [SOLVED]

April 25, 2013 9:52am

Subscribe [2]
  • #1 / Apr 25, 2013 9:52am

    Carlton

    22 posts

    Hi,

    I would like to create a PHP script that is capable of speaking to the Expression Engine channel API and make that script runnable via a cron job.

    To elaborate slightly on what I want to achieve…

    A cron job runs every 5 minutes
    Grabs a remote XML feed
    I insert these record into my channel (e.g. Articles) using the Expression Engine API

    I want this script to live outside of the document root and only runnable via the command line.

    I’m struggling to figure out where/how to place my PHP script so it has access to everything in my Expression Engine installation/config and so that I can call something like…

    ee()->load->library('api');
    // I am assuming ee is just the result of get_instance()

    With Codeigniter 2.1 the cron job support is great (I think certain updates to the way routing is handled were made), but with the codeigniter that Expression Engine is built on (2.0.1 I think), I can’t call the index.php file over the command line and specify.

    Can anybody share how they have setup a cron job to work within an Expression Engine install?

  • #2 / Apr 25, 2013 10:19am

    Carlton

    22 posts

    See http://stackoverflow.com/questions/11570255/standalone-php-script-using-expression-engine/16217186#16217186

    Managed to revisit what was suggested and found a slight modification to the suggested method to get this working

  • #3 / Sep 28, 2013 6:39pm

    riamu

    1 posts

    Sorry to resurrect this, but are you able to post some more detail on how to get this to work in this exact context? I’m looking to run a nightly script that will pull data from an XML feed that will then go through and add, update and delete records.

    Thanks,
    L

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases