Url and title with php snippet
<p>I read several similar posts but I don't see my fault.</p>

<p>index.php looks like:</p>

<pre><code>&lt;head&gt;
&lt;title&gt;Demo Title&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php 
    require_once "footer.php";
?&gt;
&lt;/body&gt;
</code></pre>

<p>footer.php looks like:</p>

<pre><code>&lt;?php
/*
 * _$ Rev. : 08 Sep 2010 14:52:26 $_
 * footer.php
 */

$host = $_SERVER['SERVER_NAME'];
$param = $_SERVER ['REQUEST_URI'];
$url = "http://".$host.$param;
echo $url;

$file = @ fopen($_SERVER[$url],"r") or die ("Can't open HTTP_REFERER.");
$text = fread($file,16384);
if (preg_match('/&lt;title&gt;(.*?)&lt;\/title&gt;/is',$text,$found)) {
        $title = $found[1];
} else {
        $title = " -- no title found -- ";
}
?&gt;
</code></pre>

<p>A request for the URL <a href="http://127.0.0.1/test/index.php" rel="nofollow">http://127.0.0.1/test/index.php</a> results in:</p>

<pre><code>http://127.0.0.1/test/index.phpCan't open HTTP_REFERER.
</code></pre>

<p>or for <a href="http://127.0.0.1/test/" rel="nofollow">http://127.0.0.1/test/</a> </p>

<pre><code>http://127.0.0.1/test/Can't open HTTP_REFERER.
</code></pre>

<p>Any hints appreciated.</p>
