Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new AsyncTask<Void, Void, String>() {
- @Override
- protected String doInBackground(Void... params) {
- String msg = "";
- DefaultHttpClient httpclient = new DefaultHttpClient();
- HttpPost httpPost = new HttpPost("http://127.0.0.1:52273/get");
- httpPost.setHeader("Content-type", "application/json");
- try {
- HttpResponse httpresponse = httpclient.execute(httpPost);
- String result = EntityUtils.toString(httpresponse.getEntity());
- } catch (ClientProtocolException e) {
- Log.v("ClientProtocolException", "ClientProtocolException");
- e.printStackTrace();
- // TODO Auto-generated catch block
- } catch (IOException e) {
- Log.v("IOException", "IOException");
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return msg;
- }
- app.post('/get',function(request,response){
- response.writeHead(200, { 'Content-Type': 'application/json' });
- response.json({success:1});
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement