【问题标题】:Jsoup connection 501 errorJsoup连接501错误
【发布时间】:2012-05-23 13:31:41
【问题描述】:

如何与 Jsoup 建立连接以填写和发送表单?

网站看起来与此类似:

          <form action="the.form" method="post"
                enctype="application/x-www-form-urlencoded"
                name="start_form"
                autocomplete="off">
             <input type="hidden" value="8F5EB4CD93CAB4E093EF7C1C733791FC" name="session" />
             <input type="text" value="" name="number" />
             <div class="right">
                <input type="submit" name="submit" value="Submit" />
             </div>
          </form>

我尝试了什么:

    Document doc = Jsoup.connect(DUMMY_URL).data("number", "123456789", "session", 
"6F80A198EC4B46B4848897A33ACAC3E8").header("Content-Type","application/x-www-form-urlencoded").userAgent("Mozilla").post();

结果:

Exception in thread "main" java.io.IOException: 501 error loading URL https://www.theurl.com
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:414)
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:391)
    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:157)
    at org.jsoup.helper.HttpConnection.post(HttpConnection.java:152)
    at Test.main(Test.java:17)

这里有什么问题?

【问题讨论】:

标签: java android jsoup


【解决方案1】:

我已经在THIS thread回答了这个问题。

如果您还有任何疑问,请尽管询问。

【讨论】:

    猜你喜欢
    • 2012-05-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 1970-01-01
    • 1970-01-01
    • 2015-07-24
    • 2013-04-10
    • 2013-11-06
    相关资源
    最近更新 更多