[thelist] JavaScript: the Back Button

Jon Haworth jhaworth at witanjardine.co.uk
Tue May 14 15:21:01 CDT 2002


Hi Tab,

> *IS* there a way to do a POST with Server-side scripting
> (no actual submitting of a form by a client)???

Yup. Probably at least as many ways as there are server-side languages :-)

I don't know ASP or CF or PERL so I'll leave those to whoever does, but
here's a PHP implementation, snarfed from the manual notes.

<?php
$fp = fsockopen ("post.example.com", 80);
if ($fp) {
  fputs ($fp, "
POST /localhost/some/script/or/other.php HTTP/1.1
Host: my.webserver.com
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
Connection: Close

a=1&b=2

");
  while (!feof ($fp)) echo fgets ($fp,128);
  close ($fp);
}
?>

"Content-length" is the size of the data (in this case, "a=1&b=2"), and
"Host" is the name of the server you're posting from.

HTH
Jon



More information about the thelist mailing list