si trasformerebbe così:
Codice PHP:
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Extends the size of an array.
*/
public void sendPostRequest() {
//Build parameter string
//String data = "/id_sra=2/id_file=1";
try {
// Send the request
URL url = new URL("https://ip?nome=pippo&cognome=pluto);
HttpsURLConnection conn = ( HttpsURLConnection ) url.openConnection () ;
conn.setRequestMethod("GET");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setAllowUserInteraction(false);
conn.setHostnameVerifier ( new NullHostnameVerifier ()) ;
conn.setRequestProperty("Content-Type", "text/plain");
//write parameters
//** writer.write(data);
//** writer.flush();
// Get the response
StringBuffer answer = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
answer.append(line);
}
reader.close();
//Output the response
System.out.println(answer.toString());
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* Starts the program
*
* @param args the command line arguments
*/
public static void main(String[] args) {
new Main().sendPostRequest();
}
private static class NullHostnameVerifier implements HostnameVerifier {
public boolean verify ( String hostname, SSLSession session ) {
return true ;
}
}
}
però mi da lo stesso errore