このサイトhttp://www.ap-ljubljana.si/vozni_red2/VR2.phpにhttppostリクエストを送信し、postリクエストに基づいて適切な応答を取得する単純なAndroidアプリケーションを構築しています。問題は、私のアプリがブラウザと同じ応答を受け取らないことです。なぜ何かアイデアはありますか?
javaファイル
`HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.ap-ljubljana.si/vozni_red2/VR3.php");
try{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("VSTOP_ID", "1"));
nameValuePairs.add(new BasicNameValuePair("IZSTOP_ID","1"));
nameValuePairs.add(new BasicNameValuePair("btnNext", "Naprej"));
httppost.setHeader("Cache-Control", "max-age=0");
httppost.setHeader("Origin", "http://www.ap-ljubljana.si");
httppost.setHeader("Referer", "http://www.ap-ljubljana.si/vozni_red2/VR2.php?DATUM="+datum+"&VSTOP_IME=Vstop...&IZSTOP_IME=Izstop...");
httppost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
httppost.setHeader("DNT", "1");
httppost.setHeader("Accept-Encoding", "gzip,deflate,sdch");
httppost.setHeader("Accept-Language", "sl-SI,sl;q=0.8,en-GB;q=0.6,en;q=0.4");
httppost.setHeader("Accept-Charset", "ISO-8859-2,utf-8;q=0.7,*;q=0.3");
//httppost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
return httpclient.execute(httppost);
}
catch (ClientProtocolException e){
return null;
}
catch (IOException e){
return null;
}`
ブラウザのhttp投稿リクエスト