【发布时间】:2019-12-06 08:54:26
【问题描述】:
我是一名 Delphi 开发人员,负责为面向公众的网站抓取 <title> 和 meta 描述和关键字。
这很好,直到我遇到一个自我重定向并且没有使用 HTTP 302/301 重定向的网站。
例如,如果我在 url 中输入 example.com,它将自动跳转到 example-b.com - 但在客户端 - 不是通过 HTTP 301 或 302。
我的目标是获取example-b.com 的标题、描述和关键字。
如果有帮助,我会在 delphi 中使用 TidHttp。
编辑
我试过这个answer,但据说它只适用于 HTTP 301 和 302。我已经处理了这些重定向。我试图弄清楚如何处理<meta>referh 标记或其他执行重定向的html 命令。
编辑 2
刚刚找到这个命令:
<meta http-equiv="refresh" content="5;url=http://thisinterestsme.com/detecting-ajax-requests-with-php/">
header( "refresh:5;url=http://thisinterestsme.com/php-forcing-https-over-http/" );
header('Location: http://thisinterestsme.com/php-forcing-https-over-http/');
window.location.href= 'http://thisinterestsme.com/php-forcing-https-over-http/';
如果我错过了其他命令,请告诉我。
【问题讨论】:
-
如果这听起来很可笑,我很抱歉,但是,“什么是 TDK”?
-
@accountant, TDK = 标题、描述和关键字