Re: Sending data via POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is from php.net:
Just change the $out to fill with your POST request (instead of the GET).  Works good, you can change ports. :)
 
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!
$fp) {
   echo
"$errstr ($errno)<br />\n";
} else {
  
$out = "GET / HTTP/1.1\r\n";
  
$out .= "Host: www.example.com\r\n";
  
$out .= "Connection: Close\r\n\r\n";

  
fwrite($fp, $out);
   while (!
feof($fp)) {
       echo
fgets($fp, 128);
   }
  
fclose($fp);
}
Currently I send data to another page by using

header("Location: http://" . $_SERVER['HTTP_HOST'] .
                    dirname($_SERVER['PHP_SELF']) .
                    "/" . $relative_url  .
                    "?" . $my_data);

My client would like the data passed via a POST rather than in the URL.

Can this be done and if so, how?

Many thanks....

Todd

--

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux