$postdata = http_build_query(
array(
'val1' => 'val1',
'val2' => 'val2',
)
);
$url = "your_post_url";
function post($url, $postdata){
$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($url, false, $context);
return $result;
}
print_r(post($url, $postdata));