一.首先确定URL地址,String url=" 输入服务器的URL地址"
二.获得httpclient对象,不建议使用默认的构造方法,httpclient client=new chttpclient(clientconnectionmanager,httpparams).
三.post对象的构建,httppost post=new httppost();
四.准备httpclient对象构建时需要的对象,httpparams params=new basichttpparam();
五.使用httpprotocolparams.set方法为params设置具体内容,例如contentcharset, timeout,
六,准备clientconnectionmanager对象,new threadsafeclientconnmanager(params,schreg);
七,准备schreg对象,new schregregistry()
八,为schreg准备内容,注册http和https方式请求许可,schreg.register()
九,用namevaluepair对象封装请求参数。
十.post.setentity(new urlencodeformentity())方法把具体内容设置给post方式。
十一.使用client.execute(post)访问服务器,其中以上十步确保了client和post对象具有请求所需要的所有设置和参数。