Android 设置wap请求方式
2012-04-03 11:36
351 查看
/* * 发送获取手机号码的请求 * */ public static String sendPhoneNumRequest(String imsi,Context context)throws Exception { String result = ""; String urlStr = "http://xxxxxxxxxxxxxxxx"; Proxy proxy = new Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress("10.0.0.200",80));//电信CTWAP代理地址是10.0.0.200 URL url = new URL(urlStr); HttpURLConnection conn=(HttpURLConnection) url.openConnection(proxy); if (conn == null){ throw new IOException("URLConnection instance is null"); } conn.setConnectTimeout(30000);// conn.setDoOutput(true); // 发送POST请求必须设置允许输出,表示允许对外输出 conn.setUseCaches(false); // 不使用Cache conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "*/*"); conn.setRequestProperty("Connection", "Keep-Alive");// 维持长连接 conn.setRequestProperty("Charset", "UTF-8"); conn.setRequestProperty("Content-Type", "text/xml; charset=UTF-8"); int responseCode = conn.getResponseCode(); Log.i("IndexActivity","responseCode is:"+responseCode); if(responseCode == 200){ InputStream stream = conn.getInputStream(); result = inStream2String(stream); }else{ } return result; }
相关文章推荐
- Android 设置wap请求方式
- [Android]解决3gwap联网失败:联网请求在设置代理与直连两种方式的切换
- Android 设置wap请求方式
- [移动网关]解决3gwap联网失败:联网请求在设置代理与直连两种方式的切换
- Android get/post方式请求网络设置超时
- android屏幕亮度设置两种方式
- android http协议post请求方式
- Android的ADT内容助手快捷方式设置
- android无标题全屏的三种设置方式
- Android开发请求网络方式详解
- Android开发——代码中实现WAP方式联网
- android网络类型 wap代理设置
- Android http请求数据 设置超时
- android 访问移动网络时的wap代理设置
- android无标题全屏的三种设置方式
- Android “设置”应用的各项如何用代码调用的方式打开
- Android中的几种网络请求方式详解 .
- 在Android 中设置xml 的文件的默认打开方式
- android中通过网络请求数据显示在Listview中,面对许多的item,如何给每个item设置点击事件以跳转到不同的activity
- Android代码中实现WAP方式联网(转载!)