Click to See Complete Forum and Search --> : Execute CGI


sstevens
12-02-2002, 06:47 PM
I'm trying to execute a CGI script from another CGI. I can type, for example,

---------------------------
exec 'http://forums.webdeveloper.com/newthread.php';
---------------------------

but I am not able to type

---------------------------
exec 'http://forums.webdeveloper.com/newthread.php?action=newthread';
---------------------------

Does anyone know a command that will let you do that?

Thanks!

jeffmott
12-02-2002, 08:37 PM
exec 'http://forums.webdeveloper.com/newthread.php';

This won't actually do anything other than throw an error. exec() executes a system command, not submit HTTP requests.

If you want to move your page to another CGI script do this:

print "Location: http://forums.webdeveloper.com/newthread.php?action=newthread\n\n";

assuming you havn't closed the HTTP header yet.

sstevens
12-03-2002, 12:25 PM
Ah hah! You're right, after further testing I found the

exec 'http://forums.webdeveloper.com/newthread.php';

wasn't doing anything. On the bright side, the

print "Location: http://forums.webdeveloper.com/newt...n=newthread\n\n";

works exactly how I need it to! Thank you so much!