如何在PHP中忽略带有file_get_contents的移动标头? [英] How do I ignore a moved-header with file_get_contents in PHP?

查看:90
本文介绍了如何在PHP中忽略带有file_get_contents的移动标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个简单的内容用户,该用户使用file_get_contents,但是不幸的是,对于我的IP,该站点现在出现302错误,可转发到图像.对于所有其他用户,正常站点是可见的.

I have programmed a simple content-user, that uses file_get_contents, but unfortunately for my IP the site now gives a 302 error that forwards to an image. For all other users the normal site is viewable.

如何重写get_contents,使其仅下载网站内容而不实际遵循重定向?

How do I rewrite the get_contents so it will just download the content of the website and not actually follow the redirect?

$html = file_get_contents("http://www.site.net/");

推荐答案

那里没有内容.重定向发生在HTTP响应中,然后再发送任何内容.

There is no content there. The redirect happens in the HTTP response before any content would be sent.

服务器决定您看到(或不看到)什么.

The server decides what you get to see (or not).

这篇关于如何在PHP中忽略带有file_get_contents的移动标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆