Created
July 21, 2017 22:12
-
-
Save jetbalsa/bf26cc30f657cd31402f557ca36c88fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = urlencode($_SERVER["REQUEST_URI"]); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_VERBOSE, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch, CURLOPT_URL, "http://web.archive.org/web/https://eroshare.com".$url); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
$response = curl_exec($ch); | |
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); | |
$header = substr($response, 0, $header_size); | |
$html = substr($response, $header_size); | |
function contains($needle, $haystack) | |
{ | |
return strpos($haystack, $needle) !== false; | |
} | |
if(contains("404 NOT FOUND", $header)){http_response_code(404); print("<h1>Sorry, Page Not Found</h1><br><h2>This page was not saved / found on the internet archive.</h2><br><br>There is not anything you can do to fix this, We just didn't have enough time to save everything<br><br><hr><pre>"); var_dump($header);var_dump($html); die();} | |
if(empty($html)){http_response_code(500); echo "<h1>ERROR, Unable to access page</h1><br><h2>If you think this is in error, Please try again!</h2><br>To Use this website, Please use the url format like https://spacescience.tech/###### -- Like if your old url was https://eroshare.com/dddddddd then you would request https://spacescience.tech/ddddddd -- This proxy is used only for eroshare links saved to the Internet Archive's Wayback Machine<br><br><br><br>Debug:<br><br><a href=http://web.archive.org/web/https://eroshare.com/$url>Try the URL at the Internet Archive</a><br><hr>"; var_dump($html); var_dump($header); die();} | |
$html = str_replace('<head>', '<head><base href="https://web.archive.org/"><!-- proxy ran by /u/xJRWR -->', $html); | |
$html = str_replace('https://v.eroshare.com/', '//web.archive.org/web/https://v.eroshare.com/', $html); | |
$html = str_replace('"//i.eroshare.com', '//web.archive.org/web/https://i.eroshare.com', $html); | |
echo $html; | |
echo "<!-- $header -->"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment