<?php
// Making a POST request to an https server
// URL: http://us3.php.net/stream#id6769950
/* Send POST request to https://secure.example.com/form_action.php
* Include form elements named "foo" and "bar" with dummy values
*/
$sock =
fsockopen("ssl://secure.example.com",
443,
$errno,
$errstr,
30);
if (!
$sock) die("$errstr ($errno)\n");
fwrite($sock,
"POST /form_action.php HTTP/1.0\r\n");
fwrite($sock,
"Host: secure.example.com\r\n");
fwrite($sock,
"Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock,
"Accept: */*\r\n");
$headers = "";
$headers .= "$str\n";
$body = "";
$body .=
fgets($sock,
4096);
?>