через file_get_contents
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array(
'http'=>array(
'method'=>"POST",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
"User-agent: BROWSER-DESCRIPTION-HERE\r\n"
),
'content' => $postdata
);
$context = stream_context_create($opts);
$file = file_get_contents('http://www.example.com/', false, $context);
либо через curl
$curl_h = curl_init('http://www.example.com/');
curl_setopt($curl_h, CURLOPT_HTTPHEADER,
array(
'User-Agent: BROWSER-DESCRIPTION-HERE',
)
);
curl_setopt($curl_h, CURLOPT_POST, 1);
curl_setopt($resource, CURLOPT_POSTFIELDS, array('key' => '123213'));
curl_setopt($curl_h, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl_h);