2011-12-02 3 views
1

いっぱいではありません。 http://android.forum-example.org/?a=1 & B = 2 & C = 3HttpPost URIは、私がリンクから<strong>JSON</strong>情報を取得したい

しかし、Log.vは、の後にそれを伝えます。request.setEntity(新しいUrlEncodedFormEntity(qparams)); 私のURIは:http://android.forum-example.org/?

私の間違いはどこですか?

コード:

try { 
    HttpClient httpClient = new DefaultHttpClient(); 
    HttpPost request = new HttpPost("http://android.forum-example.org/?"); 
    List<NameValuePair> qparams = new ArrayList<NameValuePair>(3); 
    qparams.add(new BasicNameValuePair("a", "1")); 
    qparams.add(new BasicNameValuePair("b", "2")); 
    qparams.add(new BasicNameValuePair("c", "3")); 
    request.setEntity(new UrlEncodedFormEntity(qparams)); 
    Log.v("URI:", request.getURI().toString()); 
    HttpResponse response = httpClient.execute(request); 
    } catch (IOException e) { e.printStackTrace(); } 
+0

11-06 17:21:03.758:V/URI:(13235):http://android.forum-example.org/? – Sviatoslav

答えて

1

利用HttpGetの代わりHttpPost

try { 
    HttpClient httpClient = new DefaultHttpClient(); 
    HttpGet request = new HttpGet("http://android.forum-example.org/?a=1&b=2&c=3"); 
    Log.v("URI:", request.getURI().toString()); 
    HttpResponse response = httpClient.execute(request); 
} catch (IOException e) { 
    e.printStackTrace(); 
} 
関連する問題