Php file_get_contents get title from Google cache
<p>I can easily get the page title of any site using file_get_contents, but I am really hoping to get it from Google cache.</p>

<p>The reason being, we have a site with 5000 old links, and I'm hoping to embed this on a 404 page, so if the link exists in Google's cache, it will grab the title of the page, and I can use that as a search string.</p>

<p>Here's my code, not sure if it is Google refusing (and perhaps I have to sue Curl, or if I'm behind a firewall blocking it.</p>

<p>Any help is greatly appreciated.</p>

<p>Code:</p>

<pre><code>&lt;?php
$site = "http://www.mywebsite.com/oldpage.html";
$cache = file_get_contents('http://webcache.googleusercontent.com/search?q=cache:'.$site);
if (preg_match("/&lt;title&gt;(.*)&lt;\/title&gt;/i", $cache, $matches))
{
    print($matches[1] . "\n"); // "Example Web Page"
}
else 
{
    echo 'Content could not be retrieved.'; 
}
?&gt;
</code></pre>

<p>I'm thinking it can't be done.</p>
