如何通过使用JSoup形式提交的文字 [英] How to submit text via forms using JSoup

查看:113
本文介绍了如何通过使用JSoup形式提交的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一些文本使用JSoup这种形式。我怎么会去这样做呢?

 <形式ID =quickpostform行动=的方法=邮报的风格=显示:块;文本对齐:中心;>
<输入类型=隐藏名称=行动值=回复/>
<输入类型=隐藏名称=身份验证值=54a9871a63a1c285879a5327faf3d8d2/>
<输入类型=隐藏名称=线程值=135​​454/>
< D​​IV ID =quickreplytext>
< textarea的ID =quickpost的风格=宽度:95%;的tabindex =1的onkeyup =调整('quickpost'); NAME =身体COLS =90行=8/>
< BR />
< / DIV>
 

解决方案

看看的 jsoup。连接方法和连接接口。

一旦你有了要提交蓄势待发的文字,你可以将它张贴到URL的形式提交。

例如:

 文档DOC = Jsoup.connect(URL)
    .DATA(行动,回复)
    .DATA(身份验证,54a9871a63a1c285879a5327faf3d8d2)
    .DATA(线,135454)
    .DATA(quickreplytext,replyText)
    。员额();
 

返回文档对象将是该职位的结果页面。

I'd like to submit some text into this form using JSoup. How would I go about doing this?

<form id="quickpostform" action="" method="post" style="display: block; text-align: center; ">
<input type="hidden" name="action" value="reply"/>
<input type="hidden" name="auth" value="54a9871a63a1c285879a5327faf3d8d2"/>
<input type="hidden" name="thread" value="135454"/>
<div id="quickreplytext">
<textarea id="quickpost" style="width: 95%; " tabindex="1" onkeyup="resize('quickpost');" name="body" cols="90" rows="8"/>
<br/>
</div>

解决方案

Take a look at the jsoup.connect method and the Connection interface.

Once you have the text you want to submit ready to go, you can post it to a URL as a form submission.

E.g.:

Document doc = Jsoup.connect(url)
    .data("action", "reply")
    .data("auth", "54a9871a63a1c285879a5327faf3d8d2")
    .data("thread", "135454")
    .data("quickreplytext", replyText)
    .post();

The returned doc object will be the result page of the post.

这篇关于如何通过使用JSoup形式提交的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆