请教如何用JAVA伪造referer
filter+wraper的方法试过不行
AJAX也不行
哪位还有高招?

解决方案 »

  1.   

    The following code segment may :
    URL url = new URL("http://reg.163.com/CheckUser.jsp");
    URLConnection uc = url.openConnection ();
    if (!(uc instanceof HttpURLConnection)) {
    System.err.println("Wrong connection type");
    }
                
    uc.setDoOutput(true);
    uc.setUseCaches(false);
    uc.setRequestProperty("Referer","http://www.damnjapanese.com/");
    HttpURLConnection hc = (HttpURLConnection) uc;
    hc.setRequestMethod("POST");
    OutputStream os = uc.getOutputStream();
    DataOutputStream dos = new DataOutputStream(os);
    dos.writeBytes(content);
    dos.flush();
    dos.close();
                
      

  2.   

    刚输入的是http://www.f**kjapanese.com/ 居然提交失败
    提示我的文字不文雅!
    汗!!!
      

  3.   

    String spec = "http://localhost:7001/selfhelp/mobilepwd.jsp?mobileno=13787113052";
    URL url = new URL(spec);
    HttpURLConnection openConnection = (HttpURLConnection) url
    .openConnection();
    openConnection.setRequestProperty("Referer", spec);
    BufferedReader br = new BufferedReader(new InputStreamReader(
    openConnection.getInputStream()));
    String line = null;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    }这样就OK了.