如何从网站获取特定信息并将其显示在框中?

发布于 2024-12-27 15:14:54 字数 133 浏览 0 评论 0原文

我是 AutoIT 的新手,我已经做了很多事情。

但我找不到从 div 或其他内容之间的网站读取特定信息的方法。如果那不可能,也许有办法从网站读取原始 *.txt(或 php) 文件?

I am quite newbie on AutoIT, I've done alot of things already.

But I can't find out the way to read specific information from the website that is between div or something. If thats not possible, maybe there is a way to read a raw *.txt(or php) file from the website?

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

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

发布评论

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

评论(1

紫轩蝶泪 2025-01-03 15:14:54

您可以为您的 URL 使用以下代码示例:

#include <IE.au3>

$oIE = _IECreate("http://test.com/check.php")
$divs = _IETagNameGetCollection($oIE, "div")

For $div In $divs
    If $div.className == "content-container" Then
        MsgBox(0, "Bestimmter Inhalt", $div.innerText)
    EndIf
Next

_IEQuit($oIE)

您要求提供“原始文本”,最好使用属性 innerText 来读取该文本。有关详细信息,请参阅 MSDN

此示例基本上打开一个具有给定 URL 的新 IE 窗口。然后它提取所有 div 元素并在循环中迭代它们。一旦className“content-container”,该元素的内容将显示在消息框中。最后IE窗口再次关闭。

您可以在_IECreate()函数中添加参数, 0, 0来最终隐藏浏览器窗口。

您可以使用以下两行,而不是搜索此处所示的特定

-Element

$body = _IETagNameGetCollection($oIE, "body", 0)
MsgBox(0, "Komplette Webseite", $body.innerText)

You can use the following code example for your URL:

#include <IE.au3>

$oIE = _IECreate("http://test.com/check.php")
$divs = _IETagNameGetCollection($oIE, "div")

For $div In $divs
    If $div.className == "content-container" Then
        MsgBox(0, "Bestimmter Inhalt", $div.innerText)
    EndIf
Next

_IEQuit($oIE)

You asked for the "raw Text", which is best read with the attribute innerText. See MSDN for more details.

This example basically opens a new IE window with the given URL. Then it extracts all the div-Elements and iterates through them in a loop. Once the className is "content-container" the content of this element is displayed in a message box. Finally the IE window is closed again.

You could add the parameters , 0, 0 to the _IECreate() function to hide the browser window in the end.

Instead of searching for a specific <div>-Element as shown here you could just use the following two lines...

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