JSONArray没有发送到php webservice

时间:2013-09-25 15:50:24

标签: android json web-services

我正在尝试将一个JSON格式的字符串发送到PHP webservice。我使用以下逻辑,但它无法正常工作。我正在接受

exception illegal character at query at index 71 (i.e at "["). 

有人可以指导我吗?

**my data**

http://www.server.net/appname/index.php/api/backUp?userid=34&data=[{"message":"hi","number":"12345","username":"abc","relatedto":"inbox","date":"13\/09\/2013 09:48:41 AM"},{"message":"hello","number":"98765","username":"xyz","relatedto":"sent","date":"13\/09\/2013 09:49:46 AM"}]

我使用以下逻辑

 try
                {
                    DefaultHttpClient httpClient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost(url);
                    httppost.setHeader("Content-type", "application/json");
                    ResponseHandler<String> resHandler = new BasicResponseHandler();
                    String page = httpClient.execute(httppost, resHandler);
//                  Log.v("PAGE",page);
                    return page;
                }
                catch(Exception ex)
                {
                    ex.printStackTrace();
                    Log.e("exception",""+ex);
                    return "zero";              
                }

0 个答案:

没有答案