private boolean sendSMS(String content, String receiveTime, String senderNumber) {
try {
String params = "content=" + URLEncoder.encode(content, "UTF-8") +
"&receivetime=" + receiveTime + "&sendernumber=" + senderNumber;
byte[] entity = params.getBytes();
String path = "http://192.168.1.55:8080/application/ReceiverServlet";
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setConnectTimeout(5000);
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(entity.length));
conn.getOutputStream().write(entity);
if(conn.getResponseCode() == 200){
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public static List<Contact> getContacts() throws Exception{
String url = "http://192.168.1.77:8080/web/list.xml";
HttpURLConnection conn = (HttpURLConnection)new URL(url).openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
//TODO
}
return null;
}