Welcome Guest, Not a member yet? Register   Sign In
Running CI Scripts from command line - Possible solution
#1

[eluser]fry-guy[/eluser]
While developing a newsletter script, I came across a solution to run my mailing script through the command line. Here's what I did:

1. Create a script called mailer.php in the main folder (where index.php is located)
/mailer.php - with the following content

Code:
// Mailer.php
ini_set("max_execution_time","0");
set_time_limit(0);

$mailingid = file_get_contents("data/mailing.txt");

$_SERVER['QUERY_STRING'] = '/sendmail/send/'.$mailingid;

include "index.php";

the mailing.txt file contains variable that needs to be passed to the mailing script.
Then run the script through the command line:

~]$php mailer.php

It works perfectly well for me, but I am not using mod_rewrite on this particular application and I have not tested it with mod_rewrite enabled. I will do that sometime this week and post the result here.

I hope someone will find this useful. :-)


Messages In This Thread
Running CI Scripts from command line - Possible solution - by El Forum - 12-06-2007, 06:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB