Created
March 27, 2013 00:36
-
-
Save gnrfan/5250610 to your computer and use it in GitHub Desktop.
You can upload this simple PHP script to a public server on the Internet and receive there callbacks from webservices like Facebook's Graph API and have it redirect the request to localhost or any other non-public URI.
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 | |
| define('APP_PREFIX', '/path/to/subfolder/if/any/'); | |
| define('REDIRECT_TARGET', 'http://localhost:8000/'); | |
| if (array_key_exists('redirect_target', $_REQUEST)) { | |
| $redirect_base = $_REQUEST['redirect_target']; | |
| } else { | |
| $redirect_base = REDIRECT_TARGET; | |
| } | |
| $url = $_SERVER['REQUEST_URI']; | |
| $url = str_replace(APP_PREFIX, $redirect_base, $url); | |
| header("Location: $url"); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment