Searching did not find a similar question, so: How can POST data used by PHP to generate one page be passed from that page to another PHP generated page? I have:
Wez Furlong recently wrote the php5 version on his blog (titled HTTP post from php, without cURL):
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'post',
'content' => $data
));
if ($optional_headers!== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
In the post he mentions that he always has to look up how to do this. Funny because he's one of the core developers!