RE: [PHP] Header() and POST data
Hi, I had the same problem, had to send parameters through POST to a second page I redirected to, I ended up using the curl library but I'm still facing a few troubles with it, it redirects the page, the parameters are sent through POST but the relative urls on the second page are taking the first page's domain as its base path etc. Any ideas? Lizet ___ Caribbean Property Corporation Ltd. Miramar Trade Center Edif Barcelona Ofic. 401 Miramar. Havana www.caribbeanpropertycorp.com Tel: 53-7-2047934 Fax: 53-7-2047934 _ Note: This communication is strictly confidential and is intended solely for the person to whom it is addressed. If you are not the intended recipient of this message, please be advised that any reproduction, distribution or communication of this message is strictly prohibited. If you have received this message in error, please notify us immediately and destroy the original. -Original Message- From: Todd Cary [mailto:[EMAIL PROTECTED] Sent: Thursday, May 06, 2004 4:51 PM To: [EMAIL PROTECTED] Cc: Gus Scherer Subject: [PHP] Header() and POST data I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? Todd -- 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] Header() and POST data
--- Todd Cary [EMAIL PROTECTED] wrote: I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? No, which is a very Good Thing. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header() and POST data
I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() and POST data
No I don't think so. I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() and POST data
You could create a new FORM with hidden variable. And have an automatic submit onload, going to the next location. I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() and POST data
Daniel - What is the best way to go to another page? header(location: . $new_page); Todd Daniel Clark wrote: No I don't think so. I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() and POST data
* Thus wrote Todd Cary ([EMAIL PROTECTED]): I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? No. You can use session's to pass data without the user knowing about it. And is probably a better method than using GET/POST. $_SESSION['var_to_pass'] = 'its value'; header(location: . $the_url_to_the_page); Then $the_url_to_the_page can read the session data. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header() and POST data
Yes I agree, SESSION variables would be a pretty good way to pass info to the next page. Daniel - What is the best way to go to another page? header(location: . $new_page); Todd Daniel Clark wrote: No I don't think so. I need to go to another page and I use the header(location: . $the_url_to_the_page); Is it possible to use this method with POST so that the info does not show in the URL? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Header Redirect POST
On 25 March 2004 20:17, Chris Thomas wrote: I am not sure if this was designed like this, or if its just something im doing wrong. Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The problem that im running into is that the posted data is available in other.php. I would like to get it so that in other.php $_POST should be an empty array At a guess, you're using Apache and it's doing an internal redirect because you've used a relative pathname (so the file must be in the same document root!); in this case, Apache just does a silent internal substitution of the redirect page, and all data associated with the context will remain intact -- there is no round-trip back to your browser. If you use an absolute URL in the Location: header, Apache will return the redirect to your browser -- and because your browser now knows it's a genuine new request, the POST data is not resent. The trick is to look at the URL appearing in your browser's address bar -- if it stays as the originally requested address, Apache did an internal redirect; if it changes to the redirect address, it was an external redirect which round-tripped to your browser. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header Redirect POST
I am not sure if this was designed like this, or if its just something im doing wrong. Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The problem that im running into is that the posted data is available in other.php. I would like to get it so that in other.php $_POST should be an empty array Any suggestions?? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Redirect POST
Chris Thomas wrote: I am not sure if this was designed like this, or if its just something im doing wrong. Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The problem that im running into is that the posted data is available in other.php. I would like to get it so that in other.php $_POST should be an empty array Any suggestions?? Chris If the processing page and other.php page are two separate pages I don't see how you could be getting the same $_POST data that the processing page is receiving. You aren't passing any data from your processing page to hidden form inputs (or something) on that page before you call header() are you? Perhaps if you gave an example of your code I might have a better idea of what is going on. You could also try using unset($_POST) in other.php to make sure $_POST is empty for that page. -- Jason Giangrande [EMAIL PROTECTED] http://www.giangrande.org http://www.dogsiview.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Redirect POST
--- Chris Thomas [EMAIL PROTECTED] wrote: Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The Location header requires an absolute URL. The problem that im running into is that the posted data is available in other.php. I think you made a typo or you're misinterpreting something. The URL referenced in a Location header will be requested with a GET request, so it is impossible that any POST data exists. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Header Redirect POST
Chris Shiflett mailto:[EMAIL PROTECTED] on Thursday, March 25, 2004 1:01 PM said: I think you made a typo or you're misinterpreting something. The URL referenced in a Location header will be requested with a GET request, so it is impossible that any POST data exists. alright cool. now we've got three chris's in a row!! chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Redirect POST
Here is a url with the problem that i was describing http://xiot.darktech.org I fiddled and I found what the problem. Header('Location: $calling) the first char in $calling can not be a / I was setting $calling with $_SERVER['PHP_SELF'] which adds the / in front of the path. I changed it to . . $_SERVER['PHP_SELF'] and it worked take a look at the url to see what was going on. Here is the code that im using --index.php print_r($_POST); ... echo form action='poll.php' method='POST'; echo input name='poll_id' type='hidden' value='1\n; echo input name='calling' type='hidden' value=' . $_SERVER['PHP_SELF'] . '\n; echo input name='poll_choice' type='radio' value=1Choice 1; echo input name='poll_choice' type='radio' value=2Choice 2; echo input name='poll_choice' type='radio' value=3Choice 3; echo input type='submit' value='submit'; echo /form; --poll.php $poll_id = $_POST['poll_id']; $poll_choice = $_POST['poll_choice']; $calling = $_POST['calling']; if (isset($poll_id)) { unset($_POST); castVote($poll_id, $poll_choice); Header(Location: $calling); exit(); } Chris Jason Giangrande [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Chris Thomas wrote: I am not sure if this was designed like this, or if its just something im doing wrong. Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The problem that im running into is that the posted data is available in other.php. I would like to get it so that in other.php $_POST should be an empty array Any suggestions?? Chris If the processing page and other.php page are two separate pages I don't see how you could be getting the same $_POST data that the processing page is receiving. You aren't passing any data from your processing page to hidden form inputs (or something) on that page before you call header() are you? Perhaps if you gave an example of your code I might have a better idea of what is going on. You could also try using unset($_POST) in other.php to make sure $_POST is empty for that page. -- Jason Giangrande [EMAIL PROTECTED] http://www.giangrande.org http://www.dogsiview.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header() and POST
I have the following problem: a php page receives POST data from a form, it needs to elaborate the data and send it to another page again in POST automatically, without the user noticing. Is it possible to use the header() function to send a POST request? If yes how? And how do I send the post data? Thanx Rik __ Mio Yahoo!: personalizza Yahoo! come piace a te http://it.yahoo.com/mail_it/foot/?http://it.my.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header() and POST
The short answer is no (based on my interpretation of your question). Consider carefully where you are wanting to send data and when. The header() function is specifically for manipulating HTTP headers in the response you will send the Web client. You are probably not wanting to post data to the client; you want to post data to another Web server, right? I cannot tell from your question what exactly you are wanting to do, to be honest. If you want to automate a post, you should look into the curl extension of PHP. If you actually only need to maintain data across several pages on your own site, please restate the question. Happy hacking. Chris P.S. You may want to use a proper name in your email client. My guess is that dsfljsdfklj kljvdskljfsdkl is going to get filtered by some people's spam-filtering software. dsfljsdfklj kljvdskljfsdkl wrote: a php page receives POST data from a form, it needs to elaborate the data and send it to another page again in POST automatically, without the user noticing. Is it possible to use the header() function to send a POST request? If yes how? And how do I send the post data? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header() and POST
Here is an example of how to manually perform an HTTP POST with PHP. If you execute this code, you should see the search results of searching the PHP manual for the term curl (using language en_US). Curl is another option for people who need to do this sort of thing. Happy hacking. Chris base href=http://www.php.net/; ? function php_post($host, $path, $data) { $http_response=; $fp=fsockopen($host, 80); fputs($fp, POST $path HTTP/1.1\r\n); fputs($fp, Host: $host\r\n); fputs($fp, Content-Type: application/x-www-form-urlencoded\r\n); fputs($fp, Content-Length: . strlen($data) . \r\n); fputs($fp, Connection: close\r\n\r\n); fputs($fp, $data); while(!feof($fp)) { $http_response.=fgets($fp, 128); } fclose($fp); list($http_headers, $http_content)=explode(\r\n\r\n, $http_response); return $http_content; } $content=php_post(www.php.net, /search.php, lang=en_USpattern=curlshow=manual); echo $content; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php