【发布时间】:2013-05-04 22:07:44
【问题描述】:
我正在使用此代码来获取 HTTP 响应:
$url = "http://example.com/";
$headers = get_headers($url);
$header = substr($headers[0], 9, 3);
echo = $header;
效果很好,但我需要隐藏引荐来源网址,所以我使用 http://href.li/,如下所示:
$url = "http://href.li/?http://example.com/";
$headers = get_headers($url);
$header = substr($headers[0], 9, 3);
echo = $header;
无论最终页面的状态如何,都会产生200 OK HTTP 状态代码。是否有可能从最后一页获取标题?或者是否有另一种方法可以在仍然使用引荐来源隐藏服务的同时实现这一目标?
【问题讨论】:
-
href.li站点不发送重定向。它发送一个包含<meta http-equiv="Refresh">标签和调用window.location.replace()的Javascript 的网页。我认为它甚至不会尝试连接到目标站点,因此它无法报告成功或失败。 -
可以用curl隐藏referer吗?
-
编辑标题,不熟悉curl
-
在PHP手册中查找,这是您想要详细控制时执行HTTP操作的常用方法。
标签: php href referrer get-headers