通常はGETメソッドで渡すけど、制限が多いので、POSTで渡してみる。
post_file_get_contents.php
<?php $url = './post_file_get_contents_oya.php'; $data = array( 'name' => 'nanashi', 'id' => '1234', ); $options = array('http' => array( 'method' => 'POST', 'content' => http_build_query($data), )); $contents = file_get_contents($url, false, stream_context_create($options)); echo $contents; ?>
post_file_get_contents_oya.php
<?php echo "氏名:" . $_POST["name"] . "<br>"; echo "ID:" . $_POST["id"];