RE: [PHP] How to POST a HTML-page with the header function
Short answer: NO. Because your method is the same as the GET method Use cookies or sessions to pass hidden variable values -Original Message- From: L. Hoeneveld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] How to POST a HTML-page with the header function We use the header() function to display a html page like this: header(Location: $mail_error_page?CODE=$CODE); But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? -- Regards, Léon Hoeneveld The Netherlands E-mail TNO: [EMAIL PROTECTED] E-mail CMG: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to POST a HTML-page with the header function
I'll study on that. And in case you have an easy example for both suggested methods I am willing to receive that. We use the PHP-pages as external services and I wonder if a session-ID can be used then. But maybe a cookie is an idea... In any case thanks and regards, Léon Hoeneveld Rick Emery wrote: Short answer: NO. Because your method is the same as the GET method Use cookies or sessions to pass hidden variable values -Original Message- From: L. Hoeneveld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] How to POST a HTML-page with the header function We use the header() function to display a html page like this: header(Location: $mail_error_page?CODE=$CODE); But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? -- Regards, Léon Hoeneveld The Netherlands E-mail TNO: [EMAIL PROTECTED] E-mail CMG: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This inbound message from KPN has been checked for all known viruses by KPN IV-Scan, powered by MessageLabs. For further information visit: http://www.veiliginternet.nl _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to POST a HTML-page with the header function
something like: setcookie(cookiename,cookievalue); header( Location: $mail_error_page); exit; in mail_error_page: ?php $mycookie = $HTTP_COOKIE_VARS['cookiename']; ? The cookie will exist until the web browser is closed.. -Original Message- From: L. Hoeneveld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 9:30 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: [PHP] How to POST a HTML-page with the header function I'll study on that. And in case you have an easy example for both suggested methods I am willing to receive that. We use the PHP-pages as external services and I wonder if a session-ID can be used then. But maybe a cookie is an idea... In any case thanks and regards, Léon Hoeneveld Rick Emery wrote: Short answer: NO. Because your method is the same as the GET method Use cookies or sessions to pass hidden variable values -Original Message- From: L. Hoeneveld [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] How to POST a HTML-page with the header function We use the header() function to display a html page like this: header(Location: $mail_error_page?CODE=$CODE); But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? -- Regards, Léon Hoeneveld The Netherlands E-mail TNO: [EMAIL PROTECTED] E-mail CMG: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This inbound message from KPN has been checked for all known viruses by KPN IV-Scan, powered by MessageLabs. For further information visit: http://www.veiliginternet.nl _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to POST a HTML-page with the header function
If you really want, you can emulate a form POST by using the CURL library. Please refer to the manual for more info on CURL. bvr. But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to POST a HTML-page with the header function
On Wednesday, February 13, 2002, at 04:04 AM, L. Hoeneveld wrote: We use the header() function to display a html page like this: header(Location: $mail_error_page?CODE=$CODE); But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? I see what you're saying -- but the problem is the HTTP protocol itself. GET data is passed along on the querystring (like you have in your header function above). POST variables are sent along as content, you can look up the official format on the web (google = HTTP 1.0 protocol) but basically you have to set up your headers to describe the fact that you are sending POST data, which are followed by a blank line (two newlines), then the POST data itself (code=$code). Just yesterday someone posted a link to the PostToHost function, which is in the archives. Sorry, I don't have the link, but I recorded the function -- it is done by opening a socket connection to the server and communicating directly to it as though it were a file. Here it is: # === # PostToHost($host, $path, $data_to_send) # --- # It is a trivial little function. # -Rasmus # === function PostToHost($host, $path, $data_to_send) { $fp = fsockopen($host,80); // $fp now points to the file opened by fsockopen fputs($fp, POST $path HTTP/1.0\n); // write the first header, with the path and the protocol // (PHP manual annotations suggest using 1.0 over 1.1) fputs($fp, Host: $host\n); // write the hostname line of the header fputs($fp, Content-type: application/x-www-form-urlencoded\n); // write the encoding type line of the header fputs($fp, Content-length: . strlen($data_to_send) . \n); // write the content-length of data to send fputs($fp, Connection: close\n\n); // close the connection, and a blank line fputs($fp, $data_to_send); // write the data to send (in POST variable form) while(!feof($fp)) { // until the end of the file, eat 128 bytes at a time echo fgets($fp, 128); } fclose($fp); // close the file } Sorry about the spacing, you'll have to clean it up in your editor. But I commented the crap out of it so that I'd/you'd understand what was going on. HTH, Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php