Re: sending form values in http header?
| From: | Simon Willison | Date: | Thu, 21 Feb 2002 13:06:24 +0000 |
| Subject: | Re: sending form values in http header? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85713@lists.php.net to get a copy of this message | ||
I have no idea why your code isn't working, but if you are interested there is a class called Snoopy which can do exactly qhat you are attempting (posting values to a form, as well as grabbing pages from URLs and other neat tricks):
http://snoopy.sourceforge.net/
marcbey wrote:
is it possible to send variables in the header to the next script with an form? script<form2.php>: $ip = "192.168.0.90"; $fp = fsockopen ( $ip, 80, $errno, $errstr, 30); $header ="POST /tests/form2.php HTTP/1.1\r\n"; $header .="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, */*\r\n"; $header .="Referer: http://192.168.0.90/tests/form2.php?\r\n"; $header .="Accept-Language: de\r\n"; $header .="Content-Type: application/x-www-form-urlencoded\r\n"; $header .="Accept-Encoding: gzip, deflate\r\n"; $header .="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"; $header .="Host: 192.168.0.90\r\n"; $header .="Content-Length: 9\r\n"; $header .="Connection: Keep-Alive\r\n"; $header .="Cache-Control: no-cache\r\n\r\n"; $header ."user=marc"; fputs ( $fp, $header, strlen( $header ) ); while ( !feof( $fp ) ) { echo fgets( $fp,128 ); } fclose($fp) and shoud connect to the script <form.php> and sending the variable user <html> <head> <?php if ( $HTTP_POST_VARS["user"] == "marc" ) { echo "http_user ist marc"; } else { echo "no user"; } ?> <form name="form1" method="post" action="?"> <input type="text" name="user"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html> it doesent work, but why? -- ------------------------------------------------------- magic garden GmbH - Agentur für Informationsarchitektur Hermannstr. 15 - 70178 Stuttgart (Am Feuersee) www.magic-garden.de ¦ beyerlin@magic-garden.de Tel. (07 11) 619 57-42 ¦ Fax (07 11) 615 01 38