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
  • 381,978
  • 94
  • 789
  • 754
VJS
  • 2,549
  • 6
  • 31
  • 58
  • 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,003
  • 3
  • 14
  • 23
1

Yes you can do it using HTTPURLConnection

eckes
  • 56,506
  • 25
  • 151
  • 189
jmj
  • 225,392
  • 41
  • 383
  • 426
1

Take a look on HttpURLConnection.

eckes
  • 56,506
  • 25
  • 151
  • 189
AlexR
  • 109,181
  • 14
  • 116
  • 194