如何设置 Http 标头来检索 json 对象
我正在尝试创建一个返回类似请求的 httpGet ,如下所示:
http://www.myserver.com /do.json?json={"magazine":"-1"}
我似乎无法正确获取标题...... 我尝试过:
url = "http://www.myserver.com/do.json";
HttpGet httpGet = new HttpGet(url);
//httpGet.setHeader("Content-type", "application/json");
httpGet.addHeader("magazine", "-1");
HttpResponse response = mHttpClient.execute(httpGet);
HttpEntity entity= response.getEntity();
is = entity.getContent();
谁能告诉我如何正确执行此操作?谢谢!
Im trying to create a httpGet that returns a similar request as :
http://www.myserver.com/do.json?json={"magazine":"-1"}
I can't seem to get the header right though....
I tried :
url = "http://www.myserver.com/do.json";
HttpGet httpGet = new HttpGet(url);
//httpGet.setHeader("Content-type", "application/json");
httpGet.addHeader("magazine", "-1");
HttpResponse response = mHttpClient.execute(httpGet);
HttpEntity entity= response.getEntity();
is = entity.getContent();
Can anyone tell me how to do this properly ?? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
注意:外部使用Base64 api
note: use Base64 api externally