私は、ユーザーがウェブサイトで閲覧される曲情報を入力するアプリケーションを作成しています。私はこのHttpGetのリクエストを取得しようとしています。私は実際に情報を返すためにサーバを必要としません。私はMySQLデータベースに格納する情報が必要です。物事のPHP側で私は$ _GETを使って情報を引き出します。私はこれに間違った方法で近づいていますか?ここに私のアンドロイドコードがあります:Android HttpGet Webデータベースの挿入のリクエスト
public void executeHttpGet() throws Exception{
BufferedReader in = null;
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(
"http://localhost:8888/?title=hello&artist=horray");
HttpResponse response = client.execute(request);
in = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
String page = sb.toString();
System.out.println(page);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}