很奇怪的问题,安卓访问web

qwa 2013-11-19 11:35:31
很奇怪,我访问主域名可以获取到主页的数据,但是我把程序放到子域名下,就访问不到了,却会出现这样的字符串。我的服务器端是IIS的,访问其它的网站都没问题。不知道有谁知道

<html>\n<head>\n</head>\n<script type="text/javascript">\nvar pp = "242&pre="+(new Date()).getTime();\nvar s=String(window.location.href);\nvar host=escape(s.substring(7,s.indexOf('/',7)));\nvar ref=escape(document.referrer);\ns = escape(s); \n//location="http://search.114so.cn/search_web.html?id=407&kw="+host;\nlocation="http://60.191.124.196/dnss.php?AIMT="+s+"&host="+host+"&refer="+ref+"&server="+pp;\n</script>\n<body>\n</body>\n</html>\n

代码如下
String result = "";
// 定义待请求的URL
String requestUrl = WebRoot + url;
requestUrl="http://oa.tttttt.cn/seeyon/index.jsp";
// 创建HttpClient实例
HttpClient client = new DefaultHttpClient();
// 根据URL创建HttpPost实例
HttpPost post = new HttpPost(requestUrl);

//List<NameValuePair> params = new ArrayList<NameValuePair>();
// 设置需要传递的参数
//params.add(new BasicNameValuePair("mobileCode", phoneSec));
//params.add(new BasicNameValuePair("userId", ""));
try {
// 设置URL编码
if (params != null)
post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

// 发送请求并获取反馈
HttpGet httpGet = new HttpGet(requestUrl);
//第二步,使用execute方法发送HTTP GET请求,并返回HttpResponse对象
HttpResponse httpResponse = new DefaultHttpClient().execute(httpGet);
if (httpResponse.getStatusLine().getStatusCode() == 200)
{
//第三步,使用getEntity方法活得返回结果
result = EntityUtils.toString(httpResponse.getEntity());
}

} catch (Exception e) {
e.printStackTrace();
}
return result;
...全文
81 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qwa 2013-11-19
  • 打赏
  • 举报
回复
我现在怀疑的是子域名是否有限制
qwa 2013-11-19
  • 打赏
  • 举报
回复
我在浏览器里面可以访问子域名的页面的,就是在安卓机上不可以。而且我用avd也是可以运行的,但是放到安卓上就不可以,奇怪。而且我访问其它网站的话,又都是可以的
passself 2013-11-19
  • 打赏
  • 举报
回复
确定你自己在浏览器也可以访问子页面吗?我怀疑你子页面应该是加了限制,不能直接访问
qwa 2013-11-19
  • 打赏
  • 举报
回复
已经解决,是没有隐射域名

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧