• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 697
  • Last Modified:

How to use HttpClient to send the request message?

How can I use HttpClient to send the below request message to 192.168.0.100?

Request message
-----------------------------------------
POST /login.asp HTTP/1.1
Host: 192.168.0.100
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071220 BonEcho/2.0.0.11
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://192.168.0.100/
Content-Type: application/x-www-form-urlencoded
Content-Length: 10

psword=123
-----------------------------------------------------------------------------------

0
alfredng1
Asked:
alfredng1
1 Solution
 
alfredng1Author Commented:
I have read your reference links before. They only provide methods info e.g. GET, POST... They didn't say how to set properties!

For example, if I use URLConnection, then I can set
urlConnection.setRequestProperty("Content-Type",  "application/x-www-form-urlencoded");

If you know how to do it, could you please show it to me?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now