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」的路徑含義。你知道嗎? 在此先感謝。用戶註冊編碼
你是我的天使。這就是我要的。我得到了你的運氣。謝謝。 –
很高興我能幫到 – joshmmo
如果我在drupal中添加額外的字段作爲整數或布爾值,我怎麼能從android發送? –