2013-10-14 55 views
0
//create a new HttpClient and post header 
    HttpClient httpClient = new DefaultHttpClient(); 
    HttpPost httpPost  = new HttpPost("http://test.site.com/testpoint/user/register"); 

// TODO Auto-generated method stub 
try{ 
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); 
    nameValuePairs.add(new BasicNameValuePair("account[pass]", "cutelady")); 
    nameValuePairs.add(new BasicNameValuePair("account[mail]", "[email protected]")); 
    nameValuePairs.add(new BasicNameValuePair("account[name]", "Samantha Carter")); 
    httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 

    //Execute HTTP post request 
    HttpResponse response = httpClient.execute(httpPost); 

}catch(Exception e){ 
    Log.e("HTTP ERROR", e.toString()); 
} 

我已經嘗試了這個代碼在Android上的Drupal的xml rpc模塊。我無法成功。它是xml rpc還是json函數?哪一個是爲了?然後,你可以給我的URL路徑發送它,以便Drupal可以接受它。我無法理解「http://test.site.com/testpoint/user/register」的路徑含義。你知道嗎? 在此先感謝。用戶註冊編碼

回答