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
  • 390,936
  • 96
  • 800
  • 764
VJS
  • 2,759
  • 6
  • 33
  • 61
  • 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,083
  • 3
  • 14
  • 23
1

Yes you can do it using HTTPURLConnection

eckes
  • 60,464
  • 27
  • 159
  • 195
jmj
  • 232,312
  • 42
  • 391
  • 431
1

Take a look on HttpURLConnection.

eckes
  • 60,464
  • 27
  • 159
  • 195
AlexR
  • 111,884
  • 15
  • 126
  • 200