Forum Moderators: coopster
<?php
$host = gethostbyname($_SERVER['REMOTE_ADDR']);
$myPIN = $_POST['PIN'];
$key = "key=" . $myPIN;
$fp = fsockopen($host, 80);
fputs($fp, "HTTP/1.1 200 Ok\r\n");
fputs($fp,"Content-Type: application/www-url-encoded\r\n");
fputs($fp, "Content-Length: " . strlen($key) . "\r\n\r\n");
fputs($fp, $key);
fclose($fp);
?>
You cannot. POST is a request from the client. The server sends a response to the POST request.
That's not exactly accurate. Take a look at the cURL extension. I think that's what is needed here if we could just get some more details as to what the OP is attempting to achieve.
I once built a lousy interface using a POST method form, that it became apparent should have been built with a few simple GETs and made more user-friendly with some rewrite rules. Anyway, what I wound up doing instead of rewriting the entire application was creating a script that uses cURL to make those POST requests in response to a regular link.