如何使用 xcode 将值插入到 HTML 表单的文本字段中?

发布于 2024-08-02 17:30:33 字数 249 浏览 1 评论 0原文

我一直在玩 NSURLConnection。

现在我试图从网页中获取一些数据,但首先我需要在网站上插入我的用户名和密码,以便获取数据。

我想知道:

  1. 如何在网页上的文本字段中插入值 如何
  2. 在提供用户名和密码后按下登录按钮

类似的应用程序(例如“iiQouta”)能够使用您的用户名和密码检索数据。

我不确定他们是如何做到的,谁能解释一下这种应用程序是如何工作的?

I have been playing around with NSURLConnection.

Now I'm trying to grab some data from a webpage, but first I need to insert my username and password on the website, in order to get the data.

I want to know:

  1. How to insert a value into a textfield on the webpage
  2. How to press the log in button, once I have supplied the username and password

Similar Apps such as "iiQouta" are able to retrieve data by using your username and password.

I'm not sure how they did it, can anyone explain how this kind of application works?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葵雨 2024-08-09 17:30:33

我认为你不能这样做。您可能想要做的是创建一个 POST 请求,该请求将用您的值填充用户名和密码并将其发送到服务器。这与手动填写数据并通过单击提交按钮发送数据完全相同(至少在大多数情况下)。

最简单的方法是使用某种软件,让您可以查看正在发送的请求(Ethereal 应该可以解决问题,Firebug 也可以帮助您),手动登录该网站并检查哪些数据是在请求中。然后只需在您的应用程序中创建类似的请求并发送即可。然而,如果这是通过 SSL 完成的(确实应该如此),数据将被加密,因此您必须自己分析登录表单并弄清楚如何手动创建正确的 POST 请求。

I don't think you can do that this way. What you probably want to do is to create a POST request that will have username and password filled in with the values of yours and send that to the server. This will be exactly as filling the data manually and sending it by clicking submit button (in most cases at least).

The easiest way to do that is to use some kind of software that allows you to see the requests you are sending (Ethereal should do the trick, Firebug can help you as well), manually log in to that site and check what data is in the request. Then just create similar request in your app and send it. However it this is done over SSL (and it really should be) the data will be encrypted so you have to analyze the login form yourself and figure out how to manually create correct POST request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文