I want to read other sites on my web with file_get_contents()
. My value can be with javascript merging.
My site page is : http://example.com/page.html#2010/09/awesome.html
JAVASCRIPT
var hash = window.location.hash.substr(1);
// results: 2010/09/awesome.html
PHP
$hash = "<script>document.write(hash);</script>";
$resultLink = "http://www.external-site.com/" .$hash;
$content = file_get_contents($resultLink);
$first_step = explode("<div class='post-entry'>" , $content );
$second_step = explode("</div>" , $first_step[1] );
echo $second_step[0];
Here $resultLink is : http://www.external-site.com/2010/09/awesome.html
But file_get_contents($resultLink)
can not open the page.
How can I fix this code?