I want to make a post request using HttpClient or XMLHTTP similar to this.
POST http://www.indianrail.gov.in/cgi_bin/inet_trnnum_cgi.cgiHTTP/1.1
Host: www.indianrail.gov.in
Connection: keep-alive
Content-Length: 39
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://www.indianrail.gov.in
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://www.indianrail.gov.in/train_Schedule.html
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
lccp_trnname=19329&getIt=Please+Wait...
Have seen the code sample of httpclient, but I didn't understand much from that.Typically facing the problem in setting the headers.Below is what I have tried.Also, want to know how to send the string( lccp_trnname=19329&getIt=Please+Wait...) to the server.
httpClient = new Windows.Web.Http.HttpClient();
httpClient.defaultRequestHeaders.host(new Windows.Networking.HostName("www.indianrail.gov.in"));
httpClient.defaultRequestHeaders.connection("keep-alive");
httpClient.defaultRequestHeaders.accept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
httpClient.defaultRequestHeaders.userAgent.parseAdd("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
httpClient.defaultRequestHeaders.referer("http://www.indianrail.gov.in/train_Schedule.html");
httpClient.defaultRequestHeaders.acceptEncoding("gzip, deflate");
httpClient.defaultRequestHeaders.acceptLanguage("en-US,en;q=0.8");