Last active
October 10, 2016 14:39
-
-
Save DawTaylor/3ccf372692d425ea7ac0daf693ea0596 to your computer and use it in GitHub Desktop.
PHP $_GET sample for a simple URL reversing
This file contains 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 | |
//Saves $_GET['url'] parameter to var | |
$reverseURL = $_GET['url']; | |
//Logs the reverse URL to page | |
echo "Reverse URL => " . $reverseURL . "<br />"; | |
//Reverts the $reverseURL string and saves it to var | |
$regularURL = strrev($reverseURL); | |
//Logs the regular (unreversed) URL to page | |
echo "Regular URL => " . $regularURL . "<br />"; | |
//You can save this file and use the built-in PHP server to test it, if desired. | |
//Just access it from a web server passing your reverse URL as url GET parameter. | |
//http://localhost:8080/get_sample.php?url=moc.elpmaxe//:ptth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment