import java.io.*;
import java.net.*;
import java.util.Scanner;
public class RandomWeb {
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
System.out.println("Your Website:");
String siteUrl = scan.next();
System.out.println("Your Range of Number:");
String range[] = scan.next().split(",");
System.out.println("Setting Wait:");
int slpTime = scan.nextInt();
int rangeStart = Integer.parseInt(range[0]);
int rangeEnd = Integer.parseInt(range[1]);
if(rangeStart > rangeEnd){
System.out.println("Range Error!");
return;
}
for(int i = rangeStart ; i < rangeEnd ; i++){
Thread th = new Thread(new GetHtml(siteUrl.replaceAll("###",String.valueOf(rangeStart)),slpTime));
th.start();
}
}
public static class GetHtml implements Runnable{
String urlToRead;
int slpTime;
GetHtml(String urlToRead,int slpTime){
this.urlToRead = urlToRead;
this.slpTime = slpTime;
}
public void run() {
URL url; // The URL to read
HttpURLConnection conn; // The actual connection to the web page
BufferedReader rd; // Used to read results from the web page
String line; // An individual line of the web page HTML
String result = ""; // A long string containing all the HTML
try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
}
rd.close();
} catch (Exception e) {
//System.out.println("Web site not found!!");
e.printStackTrace();
}
try{
Thread.sleep(slpTime*1000);
}catch(Exception e){
System.out.println("wait time error!!");
}
}
}
}
分享到:
相关推荐
Install and configure an XMPP server and use it to connect from a traditional desktop client and send a message Build a simple server-side application that will respond to messages from our logged in ...
Install and configure an XMPP server and use it to connect from a traditional desktop client and send a message Build a simple server-side application that will respond to messages from our logged in ...
This practical guide gives you 100 ready-to-run PHP functions for solving most of the main problems you encounter when building a dynamic website with PHP. Every plug-in in the book offers a complete ...
You can send messages with a client/server type setup.<END><br>57 , al40.zip Apparently, if you use AOL to connect to the Internet and you do not touch it for 45 minutes it will timeout and drop ...
4.3.1 A Simple Spawn Controller..................................49 4.3.1.1 Script Breakdown................................52 4.3.2 Trigger Spawner...........................................56 4.3.3 ...
send cash (Euro currency or US Dollars) in an envelop to my street address or buy a gift certificate at Amazon in the UK. I will then use it to buy books. Here is the direct URL at Amazon UK (nearest ...
The connected client cannot get back to the root folder after navigating to a subfolder - fixed. Known problems and restrictions FTP client and server - data connection uses IpV4 protocol only. Socks...
MapView - Map process addresses to section offsets Wait/Reply port - Receive/Send message to port <br>SPACE Implementation -------------------- CPUs are implemented using NT threads....
only allowing people using a particular ISP to get into a certian directory) or you may want to ban certian IP addresses (for example, keeping disruptive memembers out of your message boards)....
To compile & install log4erl, download source from google code's website (http://code.google.com/p/log4erl/) or from svn: $> svn checkout http://log4erl.googlecode.com/svn/trunk/ log4erl or from ...
(A)启动Excel,选择菜单“数据->导入外部数据->导入数据”,选择RadminM.txt文件; (B)文本导入向导第1步,直接单击“下一步”; (C)第2步必须选中“逗号”分隔符,再单击“下一步”; (D)第3步必须将所有18列都...
(A)启动Excel,选择菜单“数据->导入外部数据->导入数据”,选择RadminM.txt文件; (B)文本导入向导第1步,直接单击“下一步”; (C)第2步必须选中“逗号”分隔符,再单击“下一步”; (D)第3步必须将所有18列都...
- new hdimage method get_capabilities() that can return special flags - vmware3, vmware4 and vvfat classes now return HDIMAGE_HAS_GEOMETRY flag - other disk image modes by default return HDIMAGE_...