JSoup HTTP error fetching URL. Status=405

允我心安 提交于 2019-12-04 04:45:13

问题


i would like connect to https://www.notebooksbilliger.de/ but with following code it does not work:

try
    {
        Response response = Jsoup.connect(url)
                .userAgent("Mozilla")
                .ignoreContentType(true)
                .execute();
        System.out.println(response.url());
        doc = response.parse();
    }
    catch (IOException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

Why i get status 405? How i could solve this problem?

Many thanks..

Sebastian


回答1:


Problem solved

Changed useragent from "Mozilla" to "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0)"



来源:https://stackoverflow.com/questions/41487157/jsoup-http-error-fetching-url-status-405

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!