根据 请求URL 指定要爬取的页面
再通过相应请求为200(请求相应成功)进行下一步操作
通过IO操作将页面输出
上源码:
package com.fussent.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class WebPathSource {
public static void main(String args[]){
URL url;
int responsecode;
HttpURLConnection urlConnection;
BufferedReader reader;
String line;
try{
//生成一个URL对象,要获取源代码的网页地址为:http://www.sina.com.cn
url=new URL("http://www.sina.com.cn");
//打开URL
urlConnection = (HttpURLConnection)url.openConne