Ok! purtroppo non ho modificato il messaggio prima di 60 minuti e quindi lo riposrto indentato in un nuovo messaggio:
codice:
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class prova {
private final String USER_AGENT = "Mozilla/5.0";
public static void main(String[] args) throws Exception {
prova http = new prova();
System.out.println("Send Http POST request");
http.sendPost();
}
// HTTP POST request
private void sendPost() throws Exception {
String url = "https://areaclienti3.tre.it/login_133.jsp?service=https%3A%2F%2Fareaclienti3.tre.it%2F133%2Fprofilo.jsp<=LT-11962399-NAXtCKUqT3ATw9PcUvSGgmwEnfYEvN&flowExecutionKey=e1s1";
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
// add header
post.setHeader("User-Agent", USER_AGENT);
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("username1", "33********"));
urlParameters.add(new BasicNameValuePair("password", "PASSWORD"));
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
System.out.println("\nSending 'POST' request to URL : " + url);
System.out.println("Post parameters : " + post.getEntity());
System.out.println("Response Code : "
+ response.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(new InputStreamReader(response
.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
}
}