2

I'm confused as to how a pass POST data to a php script via cgi-bin, I understand it's via stdin with the proper environment variables being set. I would think this should work?

Cat page.php:

<?php
echo $_POST['fname'];
?>

$ echo 'fname=123' | REQUEST_METHOD=POST SCRIPT_FILENAME=page.php REDIRECT_STATUS=CGI CONTENT_LENGTH=10 CONTENT_TYPE=application/www-form-urlencoded php-cgi 

Content-type: text/html

<br />
<b>Notice</b>:  Undefined index: fname in <b>/home/web/html/page.php</b> on 
line <b>2</b><br />
  • 1
    Might be helpful too: https://stackoverflow.com/questions/5655284/how-to-pass-parameters-from-command-line-to-post-in-php-script – IncredibleHat Oct 12 '17 at 18:43
  • 1
    I saw that post, and derived the above from it. I'm curious what is missing and why the proposed solution won't work. – Mark Cowoan Oct 12 '17 at 22:41
  • Oh! Gotcha. Yeah, I read over it, and read your example, and couldn't see why it shouldn't work. So I posted the link hoping you may see something I overlooked. Guess that was were you came from to start, so, hm, back to square one. – IncredibleHat Oct 12 '17 at 22:44
  • I'll have to look at some http server cgi-bin source I guess. – Mark Cowoan Oct 14 '17 at 21:59

0 Answers0