I am learning and I am trying post data to 4.php and get the result to printed on range.php.. I have already seen the How to post data in PHP using file_get_contents?
<?php
error_reporting(-1);
$postdata = http_build_query(
array('var1' => 'sugumar',
    'var2' => 'doh')
);
$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('http://localhost/php/4.php', false, $context);
 print_r($result);//DOESN'T PRINT ANYTHING
?>
4.php
 print_r($_REQUST);
$postdata = http_build_query($_POST);
print_r($postdata);
I want to know why it's not printing anything... please help me..
 
     
    