$body = [
'p1'=> 'p1',
'p2'=> 'p2'
];
$opts = array(
'http'=>array(
'method'=>"POST",
'header' => "Content-Type: application/x-www-form-urlencoded",
'content' => http_build_query($body)
//'content' => json_encode($body) //可以json格式方式 这时候Content-Type 需要改成application/json
)
);
$context = stream_context_create($opts);
$client = file_get_contents('url', false, $context);
$jsonR = json_decode($client);