<?php
function post($url,$parameter="",$referer="",$cookies="")
{
/*
$parameter 格式为:aa=1&bb=2
$cookies 格式为:aa=1;bb=2
*/
$returnResult = array();
$returnResult["content"] = false;
$returnResult["cookies"] = false;
$context['http'] = array   
(   
'method' => 'POST',
'header'=>"Content-type: application/x-www-form-urlencoded\r\n".   
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11\r\n" .
"Cookie:{$cookies}\r\n" . 
"Referer:{$referer}\r\n" .
"Content-Length:100\r\n" .
"\r\n",
'content' => $parameter
);
echo file_get_contents($url,false,stream_context_create($context));
}
post("http://www.lishirenwu.com.cn/");
?>Warning: file_get_contents(http://www.lishirenwu.com.cn/) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 405 Method Not Allowed in F:\cc\index.php on line 22