array( 'method' => 'POST', 'content' => json_encode($data), 'header' => "Content-Type: application/json\r\n" . "Accept: application/json\r\n" ) ); $context = stream_context_create($request); $result = file_get_contents($url, false, $context); $response = json_decode($result); return $response; }