2

Can we create a HTTP request (GET or POST) programmatically.

Like in other protocols(ex : SIP) we can create a request programmatically but i have a doubt for HTTP.

skaffman
  • 398,947
  • 96
  • 818
  • 769
VJS
  • 2,891
  • 7
  • 38
  • 70
  • see http://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java –  Jan 17 '12 at 09:51
  • Have a look at http://stackoverflow.com/questions/643730/httpclient-vs-httpurlconnection for alternatives to java.net.HttpUrlConnection – Wolfgang Kuehn Jan 17 '12 at 10:03

3 Answers3

2

Yes, it is definitely possible.

Have a look here: java.net.HttpUrlConnection

Sample code can also be found there.

zeta
  • 1,113
  • 3
  • 15
  • 24
1

Yes you can do it using HTTPURLConnection

eckes
  • 64,417
  • 29
  • 168
  • 201
jmj
  • 237,923
  • 42
  • 401
  • 438
1

Take a look on HttpURLConnection.

eckes
  • 64,417
  • 29
  • 168
  • 201
AlexR
  • 114,158
  • 16
  • 130
  • 208