The access URL appears: illegal character in scheme at index x
Use the get method to request data, and the parameters are after the url.
At first I thought it was a character encoding problem, but when I used utf-8, I found it was useless, and then some mobile phones would not report errors, and some mobile phones would;
public static void getRemoteJsonContent(final Map<String, String> param, final String url, final XValueCallback<String> callBack) throws Exception { String tempUrl = url; String jsonResult = ""; //post request returns result DefaultHttpClient httpClient = new DefaultHttpClient(); String paramStr = ""; if (param != null) { for (String key : param.keySet()) { // paramStr += URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(param.get(key), "UTF-8") + "&"; paramStr += key + "=" + param.get(key) + "&"; } if (!TextUtils.isEmpty(paramStr)) { tempUrl += "?" + paramStr; } } HttpGet method = new HttpGet(tempUrl.trim()); HttpResponse result = httpClient.execute(method); /**Request sent successfully and get response**/ if (result.getStatusLine().getStatusCode() == 200) { /**Read the json string data returned by the server**/ jsonResult = EntityUtils.toString(result.getEntity(), "UTF-8"); callBack.onSuccess(jsonResult); } }
here url is
String url = " http://testurl/xaeo/App/Api/app.php?name=13415654215&password=123456";
Looking closely, I found that there is an illegal character in it, that is, there is a space at the beginning; remove the space and it will be fine.