You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PHP使用file_get_html获取https://piugame.com页面源码时遭遇重定向循环问题的咨询

PHP使用file_get_html获取https://piugame.com页面源码时遭遇重定向循环问题的咨询

我想通过PHP获取https://piugame.com的HTML源码,但运行代码后出现了如下错误:

Warning: file_get_contents(https://piugame.com): Failed to open stream: Redirection limit reached, aborting in /simple_html_dom.php on line 82

之后我尝试用iframe标签嵌入这个网址,打开开发者工具后发现页面陷入了重定向循环,截图如下:

页面重定向循环截图

想请教一下:这个重定向循环是什么原因导致的?我该怎么解决这个问题,成功获取到页面的HTML源码呢?

以下是我用来获取源码的PHP代码:

<?php
    include 'simple_html_dom.php';

    $html = file_get_html('https://piugame.com');
    echo $html;
?>

还有用来测试重定向的HTML代码:

<HTML>
<iframe src="https://piugame.com"></iframe>
</HTML>

备注:内容来源于stack exchange,提问作者LEVI PIU_

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 12:49:37