コード例 #1
0
  @Test
  public void testPaipai() throws Exception {
    String url = "http://bbs.paipai.com/portal.php";

    browser.getConnection(url);
    String html = browser.getHTML();
    //
    // browser.postConnection("http://bbs.paipai.com/forum.php?mod=post&action=reply&fid=13&tid=1656875&referer=http%3A//bbs.paipai.com/thread-1656875-1-1.html%3FPTAG%3D32272.2.13", httphead);

    System.out.println(html);
  }
コード例 #2
0
  private static void _testName(String name, StringBuffer result) throws Exception {
    String urlName = CodeUtil.URLEncoder(name);
    // String url =
    // "http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&client=aff-1616dh&affdom=1616dh.com&channel=footer&q="
    // + urlName + "&oq=" + urlName +
    // "&aq=f&aqi=&aql=&gs_sm=e&gs_upl=26669l27054l0l3l3l0l0l0l0l0l0ll0";

    String url = "http://www.baidu.com/baidu?word=" + urlName + "&tn=myie2&ch=3";

    browser.getConnection(url);

    int count = RegexpUtil.matchGroups(browser.getHTML(), "(" + name + ".{0,10}公司)").length;
    System.out.println(count);

    result.append(name).append("=>").append(count).append("\r\n");

    Thread.sleep(5 * 1000);
  }