Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $site_path = dirname($_SERVER['SCRIPT_NAME']);
- if ($site_path <> '/') {
- $site_path .= '/';
- }
- $uri = $_SERVER['REQUEST_URI'];
- $uri = preg_replace('|/{2,}|', '/', $uri);
- $uri = $site_path == $uri ? '' : substr($uri, strlen($site_path));
- $cache_enabled = false;
- $cache_file = 'cache/' . md5($uri);
- if ($cache_enabled && file_exists($cache_file)) {
- echo file_get_contents($cache_file);
- }
- else {
- $content = @file_get_contents('http://www.tenderhunter.ru/' . $uri);
- $content = preg_replace('~(?<= href=")/([^/].*)~', $site_path . '$1', $content);
- echo $content;
- if ($content && $cache_enabled) {
- file_put_contents($cache_file, $content);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement