发送从Android应用程序textstring到网站上的表单?表单、应用程序、网站、Android

2023-09-06 15:32:00 作者:心痛谁懂

我试图将一个字符串从我的应用程序到一个网站贴上。

I'm trying to paste a string from my application to a website.

我的应用程序看起来以下几点:一是的EditText和一个按钮。我的按钮打开一个网站,一个开放的文本框。

My application looks as following: one EditText and one Button. My button opens a website with an open text box.

<input name="FreeTextBox" type="text" id="FreeTextBox" style="width:64px;">

这是文本框的网站

我的应用程序的EditText id是 ET2 中,然后在java中变量克拉斯克拉森= klass.getText()的toString(); 然后克拉斯变量被制作成所谓的字符串克拉森

My application's EditText id is et2 which is then the variable klass in java. klassen = klass.getText().toString(); The klass variable is then made into a string called klassen

当我点击我的按钮,我打开一个网站,然后我想我的应用程序自动进入什么我写在我的EditText到网站上的FreeTextBox。

When I click my button I open a website and then I want my application to automatically enter whatever I wrote in my EditText into the FreeTextBox on the website.

请给我如何做到这一点的建议。这是我的第一个应用程序,所以我真的可以使用一些帮助。

Please give me advice on how to do this. This is my first application so I could really use some help.

在此先感谢

推荐答案

你有过的网站的控制?如果没有,那么你会需要得到更多的信息,如表单操作,输入名称,例如:

Do you have control over the website? if not, then you are gonna need to get some more information, like the form action, and the input name, for example

<form name="input" action="html_form_action.php" >
Username: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>

如果窗体是像上面我喜欢用一个 JSOUP (下载并导入到你的项目)

If the form is like the one above I like using JSOUP (Download and import to your project)

然后我会用code是这样的:

Then I would use a code like this:

Jsoup.connect("http://****/html_form_action.php").data("user",yourTextString).post();

这code有同样的效果,如果你会粘贴在网站上的字符串,然后点击提交按钮。但同样,这可能不是你在找什么,所以请更具体的(表格源$ C ​​$ c和东西)

This code has the same effect as if you would have pasted the string in the website and then hit the Submit button. But again this might not be what you are looking for so please be more specific (Form source code and stuff)