Ejemplo n.º 1
0
 /**
  * 注册新浪微博用户接口
  *
  * @param args
  */
 public static void main(String[] args) {
   System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
   System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
   try {
     Weibo weibo = getWeibo(false, args);
     // IP必须被平台列入白名单方可执行注册接口
     String IP = InetAddress.getLocalHost().getHostAddress();
     // args参数从第三个开始为昵称、性别、密码、邮箱;
     JSONObject object = weibo.register(IP, "", "", "nick", "m", "passwd", "*****@*****.**");
     System.out.println("Your ID:" + object.getString("uid"));
   } catch (Exception e) {
     e.printStackTrace();
   }
 }