简体   繁体   English

从发布网址C#获取数据

[英]Get the data from a post URL C#

I have the post URL which can return the data as JSON format when I parse the url with fiddler 我有发布网址,当我用提琴手解析网址时,该网址可以将数据以JSON格式返回

How can I get the ID in JSON Data in C# 如何在C#中获取JSON数据中的ID

Thank you, I tried to use some functions in WebClient, but i got no result. 谢谢,我尝试在WebClient中使用某些功能,但没有结果。

Thanks 谢谢

Try this 尝试这个

var body = HttpContext.Current.Items["RequestBody"].ToString();

UPDATE 更新

Try this 尝试这个

            var url =
            "https://secure.reservation-booking-system.com/beapi/rest/rsearch/hotelinfo?hotelId=18234&format=json&lang=fr-fr&domain=www.l-hotel.com";

        using (var webclient = new WebClient()){

            //Add data to body
            var values = new NameValueCollection();
            values.Add("hotelId", "18234");
            values.Add("format", "json");
            values.Add("lang", "fr-fr");
            values.Add("domain", "www.l-hotel.com");

            //Make request
            var response = webclient.UploadValues(url, values);

           //read Response
            var responseBody = Encoding.ASCII.GetString(response);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM