php - Can't send a lot of variables from android to server -
i have problem android studio. have lot of variables(76 variables) in android when want sent them server have problem. can't send data server. when try reduce variable became 2 variable work. can explain that?
private void orderproses(string merk,string tipe,string tipe_mesin,string transmisi,string warnaint,string warnaext,string pernahlaka,string lamakepemilikan,string silinder,string kondisibeli,string kondisiumum, string fiturmobil,string speedometer,string ukuran,string harga,string penjual,string nohp,string s1,string s2,string s3,string s4,string s5,string s6,string s7,string s8,string s9,string s10,string s11,string s12,string s13,string s14,string s15,string s16,string s17,string s18, string o1,string o2,string o3,string o4,string o5,string o6,string o7,string o8,string o9,string o10,string o11,string o12,string o13,string o14,string o15, string setelah1,string setelah2, string setelah3, string setelah4, string setelah5, string setelah6, string setelah7, string setelah8, string setelah9, string no1,string no2,string no3,string no4ya,string no5ya,string no6gadai,string no7,string no8, string no4,string no5,string no6,string jb1,string jb2,string jb3,string jb4,string id,string mail) { class registeruser extends asynctask<string, void, string> { progressdialog loading; registeruserclass ruc = new registeruserclass(); @override protected void onpreexecute() { super.onpreexecute(); loading = progressdialog.show(catatanpenutupactivity.this, "please wait",null, true, true); } @override protected void onpostexecute(string s) { super.onpostexecute(s); loading.dismiss(); toast.maketext(getapplicationcontext(), s, toast.length_long).show(); //session.logoutuser(); intent = new intent(catatanpenutupactivity.this, mainactivity.class); i.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); startactivity(i); } @override protected string doinbackground(string... params) { hashmap<string, string> data = new hashmap<string,string>(); data.put("1",params[0]); data.put("2",params[1]); data.put("3",params[2]); data.put("4",params[3]); data.put("5",params[4]); data.put("6",params[5]); data.put("7",params[6]); data.put("8",params[7]); data.put("9",params[8]); data.put("10",params[9]); data.put("11",params[10]); data.put("12",params[11]); data.put("13",params[12]); data.put("14",params[13]); data.put("15",params[14]); data.put("16",params[15]); data.put("17",params[16]); data.put("18",params[17]); data.put("19",params[18]); data.put("20",params[19]); data.put("21",params[20]); data.put("22",params[21]); data.put("23",params[22]); data.put("24",params[23]); data.put("25",params[24]); data.put("26",params[25]); data.put("27",params[26]); data.put("28",params[27]); data.put("29",params[28]); data.put("30",params[29]); data.put("31",params[30]); data.put("32",params[31]); data.put("33",params[32]); data.put("34",params[33]); data.put("35",params[34]); data.put("36",params[35]); data.put("37",params[36]); data.put("38",params[37]); data.put("39",params[38]); data.put("40",params[39]); data.put("41",params[40]); data.put("42",params[41]); data.put("43",params[42]); data.put("44",params[43]); data.put("45",params[44]); data.put("46",params[45]); data.put("47",params[46]); data.put("48",params[47]); data.put("49",params[48]); data.put("50",params[49]); data.put("51",params[50]); data.put("52",params[51]); data.put("53",params[52]); data.put("54",params[53]); data.put("55",params[54]); data.put("56",params[55]); data.put("57",params[56]); data.put("58",params[57]); data.put("59",params[58]); data.put("60",params[59]); data.put("61",params[60]); data.put("62",params[61]); data.put("63",params[62]); data.put("64",params[63]); data.put("65",params[64]); data.put("66",params[65]); data.put("67",params[66]); data.put("68",params[67]); data.put("69",params[68]); data.put("70",params[69]); data.put("71",params[70]); data.put("72",params[71]); data.put("73",params[72]); data.put("id",params[73]); data.put("mail",params[74]); string result = ruc.sendpostrequest(register_url2,data); return result; } } registeruser ru = new registeruser(); ru.execute(merk,tipe,tipe_mesin,transmisi,warnaint,warnaext,pernahlaka,lamakepemilikan,silinder,kondisibeli,kondisiumum, fiturmobil,speedometer,ukuran,harga,penjual,nohp,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18, o1,o2,o3,o4,o5,o6,o7,o8,o9,o10,o11,o12,o13,o14,o15, setelah1, setelah2, setelah3, setelah4, setelah5, setelah6, setelah7, setelah8, setelah9, no1,no2,no3,no4ya,no5ya,no6gadai,no7,no8, no4,no5,no6,jb1,jb2,jb3,jb4,id,mail); }
`
public class registeruserclass { public string sendpostrequest(string requesturl, hashmap<string, string> postdataparams) { url url; string response = ""; try { url = new url(requesturl); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setreadtimeout(1500000); conn.setconnecttimeout(1500000); conn.setrequestmethod("post"); conn.setdoinput(true); conn.setdooutput(true); outputstream os = conn.getoutputstream(); bufferedwriter writer = new bufferedwriter( new outputstreamwriter(os, "utf-8")); writer.write(getpostdatastring(postdataparams)); writer.flush(); writer.close(); os.close(); int responsecode=conn.getresponsecode(); if (responsecode == httpsurlconnection.http_ok) { bufferedreader br=new bufferedreader(new inputstreamreader(conn.getinputstream())); response = br.readline(); } else { response="error registering"; } } catch (exception e) { e.printstacktrace(); } return response; } private string getpostdatastring(hashmap<string, string> params) throws unsupportedencodingexception { stringbuilder result = new stringbuilder(); boolean first = true; for(map.entry<string, string> entry : params.entryset()){ if (first) first = false; else result.append("&"); result.append(urlencoder.encode(entry.getkey(), "utf-8")); result.append("="); result.append(urlencoder.encode(entry.getvalue(), "utf-8")); } return result.tostring(); }
}
Comments
Post a Comment