gpt4 book ai didi

c - 从 Linux C 调用网页

转载 作者:太空狗 更新时间:2023-10-29 11:24:57 25 4
gpt4 key购买 nike

我需要将 http://localhost/index.html 这样的 url 中的所有 HTML 文本读入 C 中的字符串。

我知道如果我打开 telnet -> telnet www.google.com 80 Get webpage.... 它会返回所有的 html。

我如何在 linux 环境中使用 C 执行此操作?

最佳答案

我建议使用几个库,这些库在大多数 Linux 发行版上都很常见:

libcurl 和 libxml2

libcurl提供了一套完整的http特性,libxml2提供了一个解析html的模块,叫做HTMLParser

希望这能为您指明正确的方向

关于c - 从 Linux C 调用网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2769356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com