Package org.jsoup

Examples of org.jsoup.Connection


  }
 

  public void getUserPwd(String user,String pwd) {
    try {
      Connection conn = null;
      String url = "http://www.hq6m.com/?act=login_check&user="+user+"&pwd="+pwd;
      conn = ConnectionManager.getInstance().getConnection(url);
//        conn.cookie("id", "21").data("id","21","page",""+pageNo,"rows","50");
      Document doc = conn.post();
      String res = doc.text();
      System.out.println(res);
      if ("用户名格式不正确,登陆密码不正确,错误[错误码: -5]".indexOf(res)>-1
          || "密码格式不正确".indexOf(res) > -1) {
       
View Full Code Here


  public Connection getConnection(String url){
    return Jsoup.connect(url).timeout(60000);
  }
 
  public Document getDocument(String url) throws Exception{
    Connection conn = getConnection(url);
    if (conn == null) {
      throw new Exception("url connect error..."+url);
    }
    Document doc = null;
    int i = 1;
    while (doc == null) {
      try {
        doc = conn.get();
      } catch (IOException e) {
        i++;
        if (i>20) {
          Utils.print("***********("+e.getMessage()+")Try to read ("+i+") times.");
          return null;
View Full Code Here

  }*/
  //DLT 201  SSQ 101
  private static Map<String, String> readDataAicai(String gameIndex,String issueNo) {
    String url = "http://kaijiang.aicai.com/allopenprized/kaijiang.jhtml?action=historyIssue&gameIndex="+gameIndex+"&issueNo="
        + issueNo;// +
    Connection conn = Jsoup.connect(url);
    String typeName = "";
    if ("101".equals(gameIndex)) {
      typeName = "ssq";
    }else if ("201".equals(gameIndex)) {
      typeName = "dlt";
    }
    Document doc = null;
    try {
      doc = conn.get();
    } catch (HttpStatusException e) {
      System.err.println(typeName+" number: "+issueNo+" is illegal.");
      logger.error(typeName+" number: "+issueNo+" is illegal.", e);
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

        this.password = password;
    }

    public Session login() {
        try {
            Connection c = Jsoup.connect(server + "dorf1.php")
                    .data("name", account)
                    .data("password", password)
                    .data("w", "1280:800")
                    .data("s1", "Login")
                    .data("lowRes", "0")
                    .data("login", String.valueOf(System.currentTimeMillis()));
            Document d = c.post();
            return new Session(this, c.response().cookies());
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.jsoup.Connection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.