new Thread(){
            public void run() {
                
                try {

//获得输入框内容
                    String phonenum=et_phone_num.getText().toString().trim();
                    String password=et_password.getText().toString().trim();
                    String name=et_name.getText().toString().trim();
                    
                    
                    HttpClient client=new DefaultHttpClient();
                    HttpPost post=new HttpPost(urlPath);
                    //将汉字编码
                    String ss=URLEncoder.encode(name, "utf-8");
                    
                    List<NameValuePair> parameters=new ArrayList<NameValuePair>();
                    parameters.add(new BasicNameValuePair("userName", ss));
                    parameters.add(new BasicNameValuePair("userPhone", phonenum));
                    parameters.add(new BasicNameValuePair("userPassword", password));
                    
                    HttpEntity entity=new UrlEncodedFormEntity(parameters,"utf-8");
                    post.setEntity(entity);
                    HttpResponse response=client.execute(post);
                    StatusLine line=response.getStatusLine();
                    int code=line.getStatusCode();
                    if (code==200) {
                        HttpEntity entity2=response.getEntity();
                        String result=EntityUtils.toString(entity2,"utf-8");
                        Message message=new Message();
                        message.obj=result;
                        message.what=1;
                        handler.sendMessage(message);
                    }
                    
                    
                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (ClientProtocolException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            };
        }.start();

HttpClient请求网络数据的Post请求的更多相关文章

  1. HttpURLConnection请求网络数据的Post请求

    //--------全局变量----------- //注册Url    private String urlPath="http://101.200.142.201:8080/VideoP ...

  2. HttpURLConnection请求网络数据的GET请求

    //清单文件中添加权限 <uses-permission android:name="android.permission.INTERNET"/> new Thread ...

  3. react-native 项目实战 -- 新闻客户端(4) -- 请求网络数据

    1.Home.js /** * 首页 */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Te ...

  4. Android 手机卫士--构建服务端json、请求网络数据

    本文地址:http://www.cnblogs.com/wuyudong/p/5900384.html,转载请注明源地址. 数据的传递 客户端:发送http请求 http://www.oxx.com/ ...

  5. Android - 使用Volley请求网络数据

    Android - 使用Volley请求网络数据 Android L : Android Studio 14 个人使用volley的小记,简述使用方法,不涉及volley源码 准备工作 导入Volle ...

  6. HttpURLConnection请求网络数据

    //使用线程 new Thread(){            public void run() {                try {                    //先创建出了一 ...

  7. IOS开发中使用AFNetworking请求网络数据

    1.把AFNetworking的文件拖放到项目中(注意不同的版本方法不一样,本历程基于版本2013): 2.使用#import "AFNetworking.h"命令把AFNetwo ...

  8. angularjs $http请求网络数据并展示

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. post NSURLConnection请求网络数据

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

随机推荐

  1. Maven根据不同个环境打包, 获取不同的配置文件等等

    http://www.cnblogs.com/tartis/p/5391079.html <project xmlns="http://maven.apache.org/POM/4.0 ...

  2. -include和sinclude 作用

    -include和sinclude   如果有文件没有找到的话,make会生成一条警告信息,但不会马上出现致命错误.它 会继续载入其它的文件,一旦完成makefile的读取,make会再重试这些没有找 ...

  3. Java 开发必会的 Linux 命令

    作为一个Java开发人员,有些常用的Linux命令必须掌握.即时平时开发过程中不使用Linux(Unix)或者mac系统,也需要熟练掌握Linux命令.因为很多服务器上都是Linux系统.所以,要和服 ...

  4. 25. Valid Palindrome

    Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric char ...

  5. 46. Partition List

    Partition List Given a linked list and a value x, partition it such that all nodes less than x come ...

  6. [VB.NET]调用系统的文件夹选择对话框

    以下示例代码展示如何调用系统的文件夹选择对话框: Private Function SelectFolder(ByVal Describe As String, Optional ByVal Show ...

  7. ORACLE 10G 闪回建议

    Flashback Tips The following tips and restrictions apply to using flashback features. Flashback Tips ...

  8. Could not load file using Ranorex runtime : General Questions

    如果你将编译好的bin文件夹复制到另一个未安装Ranorex程序的电脑上运行遇到如下错误信息 Could not load file or assembly 'Ranorex.Core, Versio ...

  9. Android IOS WebRTC 音视频开发总结(七十)-- 移动端音视频技术优化的七个方向

    最近直播很火,很多朋友对背后的技术比较感兴趣,所以今天我们整理一篇关于移动端视频优化的文章,这篇文章是我朋友在一个技术大会上分享过的,更多内容请关注我们的微信公众号:rtcblacker 视频直播为什 ...

  10. Egret 压缩与解压(jszip)

    一 jszip是什么 二 为什么要用jszip 三 如果使用zip 一 jszip是什么 jszip 是一个 JavaScript 库,可直接在浏览器上创建 zip 压缩档. 二 为什么要用jszip ...