我已經注意到某些網站,它允許每個IP 所以我可以編程方式讓他們感到請求不是來自同一個IP來打擊有限,假HTTP GET請求
好吧,我沒有太多的不確定ABOT HTTP數據包,但我們可以在報頭註明,或地方,使他們愚弄
這裏是GET請求的代碼
public static String sendGetRequest(String endpoint, String requestParameters) {
String result = null;
if (endpoint.startsWith("http://")) {
// Send a GET request to the servlet
try {
// Construct data
StringBuffer data = new StringBuffer();
// Send data
String urlStr = endpoint;
if (requestParameters != null && requestParameters.length() > 0) {
urlStr += "?" + requestParameters;
}
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
sb.append(line);
}
rd.close();
result = sb.toString();
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
我打算這樣做來保護我自己的網站。 ,你可以告訴我哪些是我需要檢查的參數: – 2010-07-09 08:12:05
@abc:這完全取決於你的網站是如何實現的 - 但我希望有一部分API給你的源API地址。它可能最終會成爲代理,但在許多情況下,這應該仍然足夠好。 – 2010-07-09 08:13:46