Hi all,
Je voudrai transcricre en
Java (J2ME) ceci:
I would like write in Java(J2ME) these below:
POST /sendsms HTTP/1.1
Host:
www.myhost.com:80 Content-Type: application/x-www-form-urlencoded; charset="utf-8"
Content-Length: 81
?Username=ANOther.12345&PIN=9292&SendTo=447700912345&Message=Testtest
Here are my code java but it doesn't work and I don't know why:
Thread t = new Thread() {
public void run() {
String url = "www.myhost.com/sendsms";
HttpConnection http = null;
try{
http = (HttpConnection)Connector.open(url);
http.setRequestMethod(HttpConnection.POST);
http.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=\"utf-8\"");
String data = "?UN=ANOther.12345&PIN=9292&SendTo=447700912345&Message=Testtest";
String Taille = "" + data.length();
http.setRequestProperty("Content-Length",Taille );
OutputStream oStrm =null;
oStrm = http.openOutputStream();
oStrm.write(data.getBytes());
oStrm.flush();
oStrm.close();
}catch(Exception ee){
System.out.println("Pnb ");
}