tags:

views:

40

answers:

1

I need to call a script called build_report.php, pass in a URL variable named partno and wait until it is finished before continuing.

This script builds a report and then an email is sent out to our customer so I don't want the email sent until the report is generated.

Is this possible?

Which should I use exec or cURL?

+2  A: 

If its a local script, exec() or system() will do the trick.

GrandmasterB
...except that the script may have server-specific code, such as `apache_request_headers()` or `getallheaders()`
Frxstrem
No specific stuff like that. How will I know it is finished?
MB34
@MB34 `exec()` blocks until finished.
Edward Mazur
how do I pass in URL variable using exec?
MB34
See the command line interface help for PHP. I think its just a matter of passing it in as a command line argument.
GrandmasterB
@MB34 If you call `php build_report.php foo bar`, then `$argc[1]` will be `foo` and `$argc[2]` will be `bar`.
Edward Mazur
Not going to use exec, sorry.
MB34