page1.php
<?php
echo "page1";
$postdata = http_build_query(
array(
'data1' => 'hello',
'data2' => 'world'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('page2.php', false, $context);
var_dump($result);
page2.php
<?php
echo "page2";
var_dump($_POST);
page2から$_POSTで受け取ったデータを見るとdata1(hello)とdata2(world)が
あることが分かります。