Re: [PHP] POST Parameters
As for redirecting, you cannot force a client to send a POST request to another URL (thankfully). So, you either need to send the POST request yourself (and send the output to the client), or you need to think of another solution (such as using URL variables for everything). OK, that sounds good. So I have to change my approach a bit. Now I tried #!/usr/local/bin/php ?php $uri = $_ENV[REQUEST_URI] ; $script= $_ENV[SCRIPT_NAME] ; $para = substr(stristr($uri, .cgi),4) ; $rhost = http://.$_SERVER['HTTP_HOST']./cgi-bin/interchange_foundation.cgi.$para ; $xoops_interchange = http://.$_SERVER['HTTP_HOST']./xoops/modules/interchange ; $fp1 = fopen($rhost,r); // !!! here I have to pass all the parameters !! $fp2 = fopen(/home/myuser/public_html/xoops_foundation_template.html,w); while(!feof($fp1)) { $line = fgets($fp1, 4096); $line = str_replace(interchange_foundation.cgi, xoops_interchange_foundation.cgi, $line); fputs($fp2,$line,strlen($line)); } fclose($fp1); fclose($fp2); echo Location: .$xoops_interchange.\n\n ; ? The whole thing is (should be) a wrapper for the interchage shop system. I would like to have that thing covered by a XOOPS modul. For that I wrote the script shown above. 1.) It should take all parameters passed to it like the original interchange cgi link does. 2.) Open the original interchange URL with all of them. 3.) Get the result page. 4.) Replace all interchange links to point back to this wrapper. 5.) Store the result page to be interpreted further by my XOOPS interchange modul (actually it simply adds some XOOPS tags and shows it) . 6.) And after all that just redircet to my XOOPS interchange modul main page. Actually that works really fine already for links and stuff. When it comes to a form, it fails - guess why ? ´caus of the missing POST parameters (obviously). How could I 'query' a URL with POST and GET Parameters with a PHP Script ??? fopen does not have that option, right ? With perl there is a CPAN modul that could act as a HTTPclient to handle such HTTP issues properly. Well, I am no perl guy (at least not now) and would like to have solved that issue with php ;). If it could not be (what I realy doubt) I will have to dive into perl. Again, any guess will be deeply appreachiated ... Stephan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST Parameters
--- Stephan Becker [EMAIL PROTECTED] wrote: With perl there is a CPAN modul that could act as a HTTPclient to handle such HTTP issues properly. With PHP, there is PEAR: http://pear.php.net/package/HTTP http://pear.php.net/package/HTTP_Client http://pear.php.net/package/HTTP_Request Or, you can always perform the POST request yourself: http://shiflett.org/dev/php_post.phps Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST Parameters
Maybe my problem ist simple to solve, but I can´t. Here it is: A special PHP CGI Script, let´s say 'phpscript.cgi' might be called with GET or POST Parameters. Though I will never now which kind and how many of such parameters will be passed to that script, I have to do some work of mine with them and after that would like to call (redirect to) an other script passing exact the same amount and type of pararmeters origninally given to my famous phpscript.cgi. I just succeeded in handling the URL based stuff like Host, Scriptname GET Paramters etc. But how to handle the POST Data ? Any guess out there ? brgds stephan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST Parameters
All POST value are stored in the $_POST[] array, all GET values are stored in the $_GET[] array. Both POST and GET values are stored in the $_REQUEST[] array. So if you don't know whether it will be a post or a get, grab the data by accessing the $_REQUEST[] array. On Monday, September 22, 2003, at 10:25 AM, Stephan Becker wrote: Maybe my problem ist simple to solve, but I can´t. Here it is: A special PHP CGI Script, let´s say 'phpscript.cgi' might be called with GET or POST Parameters. Though I will never now which kind and how many of such parameters will be passed to that script, I have to do some work of mine with them and after that would like to call (redirect to) an other script passing exact the same amount and type of pararmeters origninally given to my famous phpscript.cgi. I just succeeded in handling the URL based stuff like Host, Scriptname GET Paramters etc. But how to handle the POST Data ? Any guess out there ? brgds stephan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST Parameters
--- Stephan Becker [EMAIL PROTECTED] wrote: A special PHP CGI Script, let´s say 'phpscript.cgi' might be called with GET or POST Parameters. Though I will never now which kind and how many of such parameters will be passed to that script, I have to do some work of mine with them and after that would like to call (redirect to) an other script passing exact the same amount and type of pararmeters origninally given to my famous phpscript.cgi. I just succeeded in handling the URL based stuff like Host, Scriptname GET Paramters etc. But how to handle the POST Data? Use the $_POST array. You can loop through it conveniently using something like the following: foreach ($_POST as $name = $value) { ... } As for redirecting, you cannot force a client to send a POST request to another URL (thankfully). So, you either need to send the POST request yourself (and send the output to the client), or you need to think of another solution (such as using URL variables for everything). Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php