madThumbs Posted December 5, 2008 Share Posted December 5, 2008 Hey guys, I really need help on this passing value to CGI and get value back to PHP stuff work. Big Thanks Ok Here is my current code: PHP Code: <?php ob_start(); passthru ("/usr/local/etc/httpd/htdocs/XXXX/testing.cgi"); $results = ob_get_contents(); ob_end_clean(); echo $results; ?> and Here is my CGI Code: #!/usr/bin/perl -wT sub test { my @n; $n[0] = 10; $n[1] = 17; $n[2] = 23; return @n; } ($first,$second,$third) = test(); print "$first-$second-$third"; If I run the code above I got this: 10-17-23 !!!! BIG HOWEVER !!!!! I would like to pass a value $myNumber to $n[0]; simple say the result I hope is: if I set $myNumber = 10000 then I got this: 10000-17-23 Link to comment https://forums.phpfreaks.com/topic/135732-need-help-on-passing-var-between-php-cgi/ Share on other sites More sharing options...
madThumbs Posted December 6, 2008 Author Share Posted December 6, 2008 The reason passing and retrieving value from CGI is, I need pass a value into a CGI function (large and complex function, no time to convert to php) and get the return of that CGI function and use it in the PHP script. And this may make it easier to under stand: ------------------------------------------ #!/usr/bin/perl -wT sub test { my @n; $n[0] = $mySuperNumber(Somehow pass this value from php and use here); $n[1] = 17; $c = $n[0] + $n[1]; return $c; } ($NewResult) = test(); print "$NewResult"; ---------------------------------------------- Then I can use the php code above to get the value of this $NewResult Am I make myself clear? Link to comment https://forums.phpfreaks.com/topic/135732-need-help-on-passing-var-between-php-cgi/#findComment-707243 Share on other sites More sharing options...
madThumbs Posted December 8, 2008 Author Share Posted December 8, 2008 problem solved. so simple ;D ;D ;D Link to comment https://forums.phpfreaks.com/topic/135732-need-help-on-passing-var-between-php-cgi/#findComment-709466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.