/**?
*?@Author?dengsilinming? *?@Date?2012-9-18? *? */?package?com.dengsilinming.mail;?
import?java.io.IOException;?
import?org.apache.commons.");?
//?PostMethod?post?=?new?PostMethod("/web_api/");?
post.addRequestHeader("Content-Type",?
"application/x-www-form-urlencoded;charset=gbk");//?在頭文件中設置轉碼?
NameValuePair[]?data?=?{?new?NameValuePair("Uid",?"dengsilinming"),//?註冊的用戶名?
new?NameValuePair("Key",?"72da78da5ff54f450505"),//?註冊成功後,登錄網站後得到的密鑰?
new?NameValuePair("smsMob",?"12345678900"),//?手機號碼?
new?NameValuePair("smsText",?"這是專用於測試的信息,能否正常發短信呢?")?};//?短信內容?
post.setRequestBody(data);?
client.executeMethod(post);?
Header[]?headers?=?post.getResponseHeaders();?
int?statusCode?=?post.getStatusCode();?
System.out.println("statusCode:"?+?statusCode);?
for?(Header?h?:?headers)?{?
System.out.println("---"?+?h.toString());?
}?
String?result?=?new?String(post.getResponseBodyAsString().getBytes(?
"gbk"));?
System.out.println(result);?
}?
}