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

exec and $_GET

P: n/a
Hi.
If I execute a php script with exec
exec("foo.php"); and foo.php reads the $_GET array (can't change that I must
work with $_GET), how can I set values to $_GET array?
Can I do it directly in foo.php?

$_GET['foobar'] = 4;

Or exec(foo.php?foobar=4); ????
--
I didn't know sci.bio.paleontology was that low traffic until I tried read
the thread "Where is everyone?" and found it to be expired.
Feb 14 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Gunnar G" <de****@comhem.sewrote in message
news:y1*******************@newsb.telia.net...
Hi.
If I execute a php script with exec
exec("foo.php"); and foo.php reads the $_GET array (can't change that I
must
work with $_GET), how can I set values to $_GET array?
Can I do it directly in foo.php?

$_GET['foobar'] = 4;

Or exec(foo.php?foobar=4); ????

I'm not sure if that works, but how about

file_get_contents('http://www.example.com/path/to/script.php?foo=bar');

OR

$_GET['foobar']=4;
include('foo.php');
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Feb 14 '07 #2

P: n/a
On 14 Feb, 08:48, Gunnar G <deb...@comhem.sewrote:
Hi.
If I execute a php script with exec
exec("foo.php"); and foo.php reads the $_GET array (can't change that I must
work with $_GET), how can I set values to $_GET array?
Can I do it directly in foo.php?

$_GET['foobar'] = 4;

Or exec(foo.php?foobar=4); ????
--
I didn't know sci.bio.paleontology was that low traffic until I tried read
the thread "Where is everyone?" and found it to be expired.
When I want to know things like this I usually knock up a couple of
simple files and just try it.

Feb 14 '07 #3

P: n/a
$_GET['foobar']=4;
include('foo.php');
Yes that worked, and with argv[] I can send parameters.

Feb 14 '07 #4

P: n/a
When I want to know things like this I usually knock up a couple of
simple files and just try it.
Yes, that is a good way, but you might just be lucky and the method doesn't
really work. For me PHP is a little too much magic right now, so I'm a
little afraid of doing like that.
Feb 14 '07 #5

P: n/a
Gunnar G wrote:
If I execute a php script with exec
exec("foo.php"); and foo.php reads the $_GET array (can't change that I must
work with $_GET), how can I set values to $_GET array?
Can I do it directly in foo.php?
Are you sure exec() is really what you want? include() sounds more
appropriate.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 14 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.