public static String ConnDB() throws ParseException, IOException {
// TODO Auto-generated method stub
String webAddress = "http://10.0.0.1:8080/jspbook/AppStore/NewFile.php";
HttpGet httpGet = new HttpGet(webAddress);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpGet);
String responseBody = EntityUtils.toString(response.getEntity());
Log.d("res", responseBody);
return responseBody;
}
Above is part of android code. I checked this code getting resopnse from php server without problem.
However, emulator not only received values from php, but also received all the php code which I dont
need.
$time = “test time”;
$grade = “test grade”;
$title = “test title”;
$content = “test content”;
echo ( “$time ” );
echo ( “$grade ” );
echo ( “$title ” );
echo ( “$content ” );
echo(“abc”);
?>
I only need value of $time , $grade , $title, $content but my emulator gets all the php code.
so.. my question is.. How can I convert php String $time to android java String time?
It seems that your server doesnt support php well. Instead of giving u plain php text you should get html output.
BTW: Did u forget the < ? php in your script?