public static boolean AddW(String u, String p, String text, byte[] pic) {
		DefaultHttpClient client = new DefaultHttpClient(
				new ThreadSafeClientConnManager());

		try {
			HashMap<String, String> params = preLogin(encodeAccount(u), client);

			HttpPost post = new HttpPost(
					"http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.5)");
			post.setHeader("Accept",
					"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
			post.setHeader("User-Agent",
					"Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");

			post.setHeader("Accept-Language", "zh-cn,zh;q=0.5");
			post.setHeader("Accept-Charset", "GB2312,utf-8;q=0.7,*;q=0.7");
			post.setHeader("Referer",
					"http://weibo.com/?c=spr_web_sq_firefox_weibo_t001");
			post.setHeader("Content-Type", "application/x-www-form-urlencoded");

			String nonce = makeNonce(6);

			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
			nvps.add(new BasicNameValuePair("encoding", "UTF-8"));
			nvps.add(new BasicNameValuePair("entry", "weibo"));
			nvps.add(new BasicNameValuePair("from", ""));
			nvps.add(new BasicNameValuePair("gateway", "1"));
			nvps.add(new BasicNameValuePair("nonce", nonce));
			nvps.add(new BasicNameValuePair("pagerefer",
					"http://i.firefoxchina.cn/old/"));
			nvps.add(new BasicNameValuePair("prelt", "111"));
			nvps.add(new BasicNameValuePair("pwencode", "rsa2"));
			nvps.add(new BasicNameValuePair("returntype", "META"));
			nvps.add(new BasicNameValuePair("rsakv", params.get("rsakv")));
			nvps.add(new BasicNameValuePair("savestate", "0"));
			nvps.add(new BasicNameValuePair("servertime", params
					.get("servertime")));

			nvps.add(new BasicNameValuePair("service", "miniblog"));
			// nvps.add(new BasicNameValuePair("sp", new
			// SinaSSOEncoder().encode(p, data, nonce)));

			/******************** *加密密码 ***************************/
			ScriptEngineManager sem = new ScriptEngineManager();
			ScriptEngine se = sem.getEngineByName("javascript");
			// FileReader f = new FileReader("d://sso.js");
			se.eval(SinaSSOEncoder.getJs());
			String pass = "";

			if (se instanceof Invocable) {
				Invocable invoke = (Invocable) se;
				// 调用preprocess方法，并传入两个参数密码和验证码

				pass = invoke.invokeFunction("getpass", p,
						params.get("servertime"), nonce, params.get("pubkey"))
						.toString();

				System.out.println("c = " + pass);
			}

			nvps.add(new BasicNameValuePair("sp", pass));
			nvps.add(new BasicNameValuePair("su", encodeAccount(u)));
			nvps.add(new BasicNameValuePair(
					"url",
					"http://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack"));

			nvps.add(new BasicNameValuePair("useticket", "1"));
			// nvps.add(new BasicNameValuePair("ssosimplelogin", "1"));
			nvps.add(new BasicNameValuePair("vsnf", "1"));

			post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

			HttpResponse response = client.execute(post);

			String entity = EntityUtils.toString(response.getEntity());

			if (entity.replace("\"", "").indexOf("retcode=0") > -1) {
				String url = entity.substring(
						entity.indexOf("http://weibo.com/sso/login.php?"),
						entity.indexOf("code=0") + 6);

				// 获取到实际url进行连接
				HttpGet getMethod = new HttpGet(url);
				response = client.execute(getMethod);
				entity = EntityUtils.toString(response.getEntity());
				System.out.println(entity);

				// 获取uid
				String uid = entity.substring(entity.indexOf("uniqueid") + 11,
						entity.indexOf("userid") - 3);

				// 获取昵称
				String nick = "";
				getMethod = new HttpGet("http://weibo.com/?wvr=3.6&lf=reg");
				response = client.execute(getMethod);
				entity = EntityUtils.toString(response.getEntity());
				Document doc = Jsoup.parse(entity);
				Elements e = doc.getElementsByClass("person_infos");
				if (e != null && e.size() > 0) {
					nick = e.get(0).text();
					System.out.println("昵称：" + nick);
				}

				String pid = "";
				if (pic != null && pic.length > 0) {
					// 上传图片
					post = new HttpPost(
							"http://picupload.service.weibo.com/interface/pic_upload.php?cb=http%3A%2F%2Fweibo.com%2Faj%2Fstatic%2Fupimgback.html%3Fcallback%3DSTK_ijax_133939711612881&url=weibo.com%2Fu%2F"
									+ uid
									+ "&markpos=1&logo=1&nick=%40"
									+ nick
									+ "&marks=1&app=miniblog&s=rdxt");

					post.setHeader("Host", "picupload.service.weibo.com");
					post.setHeader("Referer", "http://weibo.com/u/" + uid);
					ByteArrayBody bin = new ByteArrayBody(pic, "image/jpeg",
							"verifycode.png");
					MultipartEntity reqEntity = new MultipartEntity();
					reqEntity.addPart("pic1", bin);
					post.setEntity(reqEntity);
					response = client.execute(post);

					org.apache.http.Header[] hs = response
							.getHeaders("Location");
					System.out.println(hs[0].getValue());
					String picLocation = hs[0].getValue();
					pid = picLocation.substring(picLocation.indexOf("pid") + 4,
							picLocation.indexOf("token") - 1);
					System.out.println("pid: " + pid);
				}

				/*************************************************************************************/

				post = new HttpPost("http://weibo.com/aj/mblog/add?_rnd="
						+ System.currentTimeMillis());
				post.addHeader("Referer", "http://weibo.com/u/" + uid + "");
				nvps = new ArrayList<NameValuePair>();
				nvps.add(new BasicNameValuePair("_surl", ""));
				nvps.add(new BasicNameValuePair("_t", "0"));
				nvps.add(new BasicNameValuePair("hottopicid", ""));
				nvps.add(new BasicNameValuePair("location", "home"));
				nvps.add(new BasicNameValuePair("module", "stissue"));
				nvps.add(new BasicNameValuePair("pic_id", pid));
				nvps.add(new BasicNameValuePair("rank", "0"));
				nvps.add(new BasicNameValuePair("rankid", ""));
				nvps.add(new BasicNameValuePair("text", text));
				post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
				response = client.execute(post);

				entity = EntityUtils.toString(response.getEntity());
				System.out.println(entity);
				if (entity.replace("\"", "").indexOf("code:100000") > -1) {
					System.out.println("发布成功");
					return true;
				} else {
					return false;
				}
			} else {
				return false;
			}
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println(e.getMessage());
			return false;
		}
	}