http://www.cnblogs.com/samson/archive/2011/08/12/2135834.html
POST
$data = array("name" => 'tim',"content" => 'test');
$data = http_build_query($data);
$opts = array(
'http'=>array(
'method'=>"POST",
'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
"Content-length:".strlen($data)."\r\n" .
"Cookie: foo=bar\r\n" .
"\r\n",
'content' => $data,
)
);
$cxContext = stream_context_create($opts);
$sFile = file_get_contents("http://localhost/response.php", false, $cxContext);
GET
$result = json_decode(file_get_contents($url));
$data = json_encode(json_decode( json_encode( $result),true));