How to generate an automated hit to a web page using Java. This hit must be similar to a human visit. I just wrote a simple swing application. This is the simple logic behind my application... Will this be considered as a valid hit? // imports and other class decelerations int hits = 10; // number of hits BufferedReader in = null; URL xurl = new URL("http://www.google.com/"); in = new BufferedReader(new InputStreamReader(xurl.openStream())); for (int index = 1; index <= hits; index++) { while ((in.readLine()) != null) { // do nothing } } in.close(); Code (markup): If not please let me know the appropriate Java/class and method to use. Thanks
very easy to test this - have a look at your server access logs! but in a short answer - no. It'll show up as a JAVA hit to the best of my knowledge followed by your Java Version What you need to do is identify yourself (the client). Brief overview here: http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#from Presumably you will have to insert a changing variable into the from header fields, AND mask your IP address. What you essentially need to do is create a HTTP post header to send along with your 'hit'. You'll be importing: import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; and using setRequestProperty to specify your variables.