php - $_POST is empty after making a post request from android -
i trying login scheme android , php. can read response url $_post array empty.i new @ help appreciated.here android code.
protected string doinbackground(string... params) { seek { string link="http://10.0.2.2/monitorhealth"; httpclient httpclinet=new defaulthttpclient(); httppost httppost=new httppost(link); list<namevaluepair> namevaluepairs=new arraylist<namevaluepair>(2); namevaluepairs.add(new basicnamevaluepair("username","x")); namevaluepairs.add(new basicnamevaluepair("password","y")); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response=httpclinet.execute(httppost); inputstream inputstream=response.getentity().getcontent(); inputstreamreader inputstreamreader=new inputstreamreader(inputstream); bufferedreader bufferedreader=new bufferedreader(inputstreamreader); stringbuilder sb=new stringbuilder(); string line; while((line=bufferedreader.readline())!=null){ sb.append(line); } log.e("response","received:"+sb.tostring()); homecoming sb.tostring(); } in index.php there 1 statement $_post['username] shows error.
found error.just had right url. replaced with
<code> string link="http://10.0.2.2/monitorhealth/index.php"; </code> php android httprequest
No comments:
Post a Comment