2015-01-23 6 views
-1
import java.io.*; 
import java.net.URL; 
import java.net.URLConnection; 

public class Rough_Program 
{ 
public static void main(String[] args) throws IOException 
    { 
    String inputLine = null; 
    String contant = null; 
    System.setProperty("java.net.useSystemProxies", "true"); 
    System.setProperty("http.proxyHost", "10.10.10.1"); 
    System.setProperty("http.proxyPort", "3128"); 
    URL oracle = new URL("https://www.google.co.in/search?q=Old%20Trafford"); 
    StringBuffer str1 = new StringBuffer(); 
    URLConnection yc = oracle.openConnection(); 
    yc.addRequestProperty("User-Agent", "Mozilla/4.76"); 
    BufferedReader in = new BufferedReader(new InputStreamReader(
      yc.getInputStream())); 
    while ((inputLine = in.readLine()) != null) { 
     str1.append(inputLine); 
    } 
    contant = str1.toString(); 
    System.out.println(contant); 
    } 
} 
+0

코드는 다른 URL의 노력하지만, WWW에 명중하지 URL에 대한 503 : – minku

+0

을 참조하십시오. http://www.checkupdown.com/status/E503.html](http://www.checkupdown.com/status/E503.html)에서 503의 설명과 수정 방법을 확인할 수 있습니다. – Jens

+0

@jane 공유 링크를 확인한 결과 도움이되지 않습니다. 브라우저에서 잘 작동하는 Google 사이트. 하지만 자바를 사용하여 오류가 표시됩니다. – minku

답변

0

시도 :

System.setProperty("https.proxyHost", "10.10.10.1"); 
System.setProperty("https.proxyPort", "3128"); 
+0

답장을 보내 주셔서 감사합니다 .. 나는 당신의 방식대로 속성을 설정했지만 동일한 오류가 발생했습니다. – minku