// 使用Cmwap方式访问php页面
private static void testCmwapAccessPhpPage() {
try {
Log.e(TAG_FLYBUL, System.currentTimeMillis() + "start.");
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(
"10.0.0.172", 80));
URL url = new URL("http://25931.6r6r.info/adpure.php"); // adpure.php为一普通页面
for (int ii = 0; ii < 2; ++ii) // 循环是因为第一次会跳出移动的计费提醒页面,取不到真正的内容
{
HttpURLConnection uc = (HttpURLConnection) url
.openConnection(proxy);
uc.connect();
String page = new String();
BufferedReader in = new BufferedReader(new InputStreamReader(uc
.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
page += line;
}
Log.e(TAG_FLYBUL, System.currentTimeMillis() + "finished. "
+ page);
}
} catch (Exception e) {
Log.e(TAG_FLYBUL, System.currentTimeMillis() + "failed, "
+ e.getMessage());
}
}
Sunday, May 9, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment