【问题标题】:eRRORServer returned HTTP response code: 503 for URL: https://ipv4.google.com/eRRORServer 返回 HTTP 响应代码:503 用于 URL:https://ipv4.google.com/
【发布时间】:2015-03-22 02:59:31
【问题描述】:
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);
  }
}

【问题讨论】:

  • 代码在其他 url 上工作,但在 www.google.com 上没有命中。我想从谷歌获取地址和电话。但它显示错误 503。请帮助我。
  • 请参阅http://www.checkupdown.com/status/E503.html 了解 503 的说明以及如何修复它。
  • @jane 我检查了您的共享链接,它没有帮助。谷歌网站在浏览器中运行良好。但使用 java 它显示错误。

标签: java bufferedreader urlconnection stringbuffer


【解决方案1】:

尝试为https添加代理设置:

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

【讨论】:

  • 感谢您的回复。我已经按照您的方式设置了属性,但出现了同样的错误。
猜你喜欢
  • 2012-05-15
  • 2011-04-29
  • 1970-01-01
  • 2020-10-18
  • 2016-02-24
  • 2021-11-24
  • 2014-02-22
  • 2023-03-17
  • 1970-01-01
相关资源
最近更新 更多