Set method in Java HTTPURLConnection - Java

Set method

Snippet Code


  
Rate this page :
  [ 0 votes]

Use the above line of code to set Method

URL urlClass=new URL("url string"); HttpURLConnection ucon=(HttpURLConnection)urlClass.openConnection(); ucon.setRequestMethod("GET"); For post method URL urlClass=new URL("url string"); HttpURLConnection ucon=(HttpURLConnection)urlClass.openConnection(); ucon.setRequestMethod("POST");

Tags


Ask Questions

Ask Question