$url = "http://192.168.31.50:3000/pay"; $data = [ "amount" => 250 ]; $options = [ "http" => [ "header" => "Content-Type: application/json", "method" => "POST", "content" => json_encode($data) ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); echo $result;