Create your own scripts to be run by cron

From PhpCOIN Documentation

Jump to: navigation, search

phpCOIN v1.2.1b dated 2004-08-07 and later versions handles recurring processes (scripts to be run by cron) a little differently than previous versions.

1) All files to be run by cron must be placed in the /coin_cron folder

2) The header of the file must have some "where are we" code:

    # include the "where are we" code
         $cronfile = 'invoices.php';
         include('cron_config.php');

Replace the $cronfile value with the filename of your script. The cron_config.php file will figure out where your script is located, and make available to your script the following variables:

    $_PACKAGE['URL'] is the URL to phpCOIN
    $_PACKAGE['PATH'] is the directory that phpCOIN is in, relative to the web-server root.
    $_PACKAGE['DIR'] is the file-system location of the phpCOIN directory.
    When including files, this should prepend the path/filename to include
    because it will work on both Windows and *nix.

All $_PACKAGE variables use forward slashes regardless of *nix or Windows. This makes it easier for you to parse these variables if your script needs to.

If you want your script to have access to all the phpCOIN variables and common fucntions, before you get into the rest of your code also insert:

    # Include core file
         require_once($_PACKAGE['DIR'].'coin_includes/core.php');

RackSpace Hosting

Personal tools