import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Created by Administrator on 2017/6/6.
 */
public class RefererTest {
    public static void main(String[] args) throws Exception {
        String url = "http://lb.gfstack.geo:8080/OperationProxy/GatewayProxy/text06061532/Text?version=1.0.0&service=TEXT&f=json";
        HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon;)");
        conn.setRequestProperty("referer", "http://www.abc1.com");
        InputStream is = conn.getInputStream();
        StringBuffer sb = new StringBuffer();
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String strLine = "";
        while ((strLine = br.readLine()) != null) {
            sb.append(strLine.trim());
        }
        System.out.println(sb.toString());
    }
}

  

相关文章:

  • 2022-12-23
  • 2022-03-03
  • 2021-09-11
  • 2021-07-31
  • 2021-08-18
  • 2022-01-14
  • 2021-07-17
猜你喜欢
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-01-23
  • 2022-12-23
  • 2021-11-16
相关资源
相似解决方案