Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * tinyurl.php
- *
- * A simple PHP proxy script for tinyurl.com
- *
- * USAGE:
- *
- * Load
- * http://yourdomain.com/tinyurl.php?37o68u6
- * as replacement for
- * http://tinyurl.com/37o68u6
- *
- * You may also create a subdomain and use URL rewriting and the following rule:
- * RewriteEngine on
- * RewriteBase /
- * RewriteCond %{REQUEST_FILENAME} !-f
- * RewriteCond %{REQUEST_FILENAME} !tinyurl.php
- * RewriteRule (.*) tinyurl.php?$1
- * to allow usage like this: http://tinyurl.yourdomain.com/37o68u6
- *
- */
- $qs = @$_SERVER['QUERY_STRING'];
- if ($qs){
- $headers = get_headers('http://tinyurl.com/'.$qs, 1);
- if (@$headers['Location']){
- $url = is_array($headers['Location'])?$headers['Location'][0]:$headers['Location'];
- header('Location: '.$url);
- exit;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment