Re: Post but not Post
| From: | Jason Brooke | Date: | Wed, 28 Mar 2001 23:54:52 +0000 |
| Subject: | Re: Post but not Post | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45969@lists.php.net to get a copy of this message | ||
Use fsockopen to send the data:
$host = "your.host";
$port = 80;
$postdata = "field1=value1&field2=value2&field3=value3";
if ($sp = fsockopen($host, $port)) {
fputs($sp,"POST /path/to/script.php HTTP/1.0\n");
fputs($sp,"Host: $host\n");
fputs($sp,"Content-type: application/x-www-form-urlencoded\n");
fputs($sp,"Content-length: ".strlen($postdata)."\n");
fputs($sp,"Connection: close\n\n");
fputs($sp,$postdata);
fclose($sp);
}
jason
> Hello.
>
> we all know that we can send variables to another PHP file via <form> tag
> and with post method.
> now i wonder if i can send variables from a script to another like POST
> method but not using form tags.
> like my question is how can i transfer data from form to form like the
POST
> of the <form> tag, but w/o session variables or cookies, or url parameters
> (like the GET method), and w/o forms ofcourse?
>
> Currently, i'm doing this via hidden forms and automatic posting via
> JavaScript, but is there is any clean and better way?
>
> Thanks.