I'm trying to connect to a web page through a HttpURLConnection but it's not responding the same as a regular browser (firefox, chrome). I'm getting an error 500.
With the same code I can get "anyother" page (google, for example). My code is posted below, but I'm pretty sure it is ok.
Using "Live HTTP Headers" firefox addon I sent the same request and received a valid response.
//... String urlConsulta = "myURL"; URL url = new URL(urlConsulta); HttpURLConnection uConsulta = (HttpURLConnection)consulta.openConnection(); uConsulta.setDoOutput(true); uConsulta.setRequestMethod("POST"); uConsulta.addRequestProperty("Content-Type", "application/x-www-form-urlencoded"); uConsulta.addRequestProperty("Host", "host"); //...