By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

Triggering a script from another script

P: n/a
Dear readers of comp.lang.php,

I recently finished a script for a website, and altough
I'm happy with it, it's a bit too slow, due to the many
and somewhat complex queries to a MySQL database.

This has been partially solved writing the script so
that only the first person after midnight that requests
that page actually generates it. Everybody else will
get the stored html file out of that first request until
the next midnight.

A new opportunity has arisen though, because altough another
person would have to set it up, now it would be possible to
run a script through a cronjob.

Ideally, to avoid touching the first script, I'd write a
second, to be run through cronjob, that act like a browser
and triggers the page generation sometime after midnight.

I therefore tried something simple like this:

----
#!/usr/sbin/php

<?php

header("Location: http://www.euroharmony.com/~manu/hubstats2.php?which=ESSA&page4&force=1");
exit;

?>
----

But it doesn't actually do anything else other than print out

Location: http://www.euroharmony.com/~manu/hub...&page4&force=1
Content-type: text/html

What should I do instead? Am I using the wrong command?
Any hint? tip? trick?

Thank you!

Manu
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 21 Oct 2003 03:54:55 -0700, ma****@mclink.it (Emanuele D'Arrigo)
wrote:
Ideally, to avoid touching the first script, I'd write a
second, to be run through cronjob, that act like a browser
and triggers the page generation sometime after midnight.


Just call your script from the command line:

/path/to/php /path/to/your/script.php

No need for a second script.

I've used this with crontab without any problem (to send daily
e-mails).

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #2

P: n/a
> Just call your script from the command line:
/path/to/php /path/to/your/script.php
No need for a second script.


Yep, this is the way to run any script from
command line, but as you might have noticed
from the URLs above, I pass a few parameters
through the URL.

This means that I'd have to change the first
script to handle command-line style arguments,
which I'm trying to avoid.

Manu
Jul 17 '05 #3

P: n/a
On 22 Oct 2003 03:26:37 -0700, ma****@mclink.it (Emanuele D'Arrigo)
wrote:
Just call your script from the command line:
/path/to/php /path/to/your/script.php
No need for a second script.
Yep, this is the way to run any script from
command line, but as you might have noticed
from the URLs above, I pass a few parameters
through the URL.


Oops. Didn't spot that.
This means that I'd have to change the first
script to handle command-line style arguments,
which I'm trying to avoid.


Look at wget or lynx.

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.