的Android +检索数据,我打印的结果logcat的,所以我得到PHP - 从MySQL数据库
您没有权限访问此服务器上本地主机.... PHP脚本工作完美。
我如何可以访问此脚本... plz帮助我
这里是我的线
public void getData() {
String result ="";
InputStream isr = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost("http://10.224.217.67/Parking/places.php");
HttpResponse repons = httpclient.execute(post);
HttpEntity enty = repons.getEntity();
isr=enty.getContent();
Log.d("http", "ok");
} catch (Exception e) {
Log.d("Error", "http error");
viewrest.setText("Connection lost");
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(isr,"UTF-8"));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line+"\n");
}
isr.close();
result=sb.toString();
Log.d("result", result);
} catch (Exception e) {
Log.d("Error", "converting Error");
}
try {
JSONArray jArray = new JSONArray(result);
String s="";
for (int i = 0; i < jArray.length(); i++) {
JSONObject json = jArray.getJSONObject(i);
s =s+"PlaceId :"+json.getInt("PlaceId")+"\n";
}
viewrest.setText(s);
} catch (Exception e) {
Log.d("Error", "Errof"+e.toString());
}
}
请参阅此链接乌尔错误 http://stackoverflow.com/questions/8366976/wamp-错误 - 禁止你不要有权限访问phpmyadmin在这个s – Arun