81,091
社区成员
发帖
与我相关
我的任务
分享
public static void test() { String send = SmsClientAccessTool.getInstance().doAccessHTTPPost( "url", "action=send&userid=111&account=1111&password=111&mobile=111&content=取消&sendTime=&checkcontent=1", "utf-8"); System.out.println(send); }
这个就是调用发送的方法, 他这个方法需要三个参数,一个url ,一个是参数串也就是用户名密码内容什么的,另外一个就是返回值编码,我在发送的接口里面看还是正常的,发送到手机的时候中文就变成? 了,
这个的意思就是调用发送的方法传参的时候还不是乱码的
public String send(String content)
{
String result="";
try {
URL url=new URL("http://www.baidu.com/send?account=qq&pwd=123&content="+content+"");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
public static void main(String[] args) {
try {
URL url=new URL("http://www.baidu.com/");
HttpURLConnection con=(HttpURLConnection)url.openConnection();
BufferedReader br=new BufferedReader(new InputStreamReader(url.openStream(),"utf-8"));
String line;
while((line=br.readLine())!=null)
{
System.out.println("提取:"+line);
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void test() {
String send = SmsClientAccessTool.getInstance().doAccessHTTPPost(
"url",
"action=send&userid=111&account=1111&password=111&mobile=111&content=取消&sendTime=&checkcontent=1", "utf-8");
System.out.println(send);
}