简体   繁体   中英

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

How can I get the ID in JSON Data in C#

Thank you, I tried to use some functions in WebClient, but i got no result.

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);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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