Exemplo n.º 1
0
 @Override
 public void run() {
   // TODO Auto-generated method stub
   int result;
   String target = myapplication.getlocalhost() + "adduserzaninfo.php";
   HttpPost httprequest = new HttpPost(target);
   List<NameValuePair> paramsList = new ArrayList<NameValuePair>();
   paramsList.add(new BasicNameValuePair("_userid", myapplication.getUserId())); // 本人
   paramsList.add(new BasicNameValuePair("_guid", guid)); // 本人
   paramsList.add(new BasicNameValuePair("_action", gzaction)); // 本人
   try {
     httprequest.setEntity(new UrlEncodedFormEntity(paramsList, "UTF-8"));
     HttpClient HttpClient1 = CustomerHttpClient.getHttpClient();
     HttpResponse httpResponse = HttpClient1.execute(httprequest);
     if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
       String json = EntityUtils.toString(httpResponse.getEntity());
       result = Integer.parseInt(json);
     } else {
       result = 0;
     }
   } catch (UnsupportedEncodingException e1) {
     e1.printStackTrace();
   } catch (ClientProtocolException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }