How to Insert and Decode URLs with PHP

104 2
    • 1). Right-click the PHP page you want to edit. Select "Open With," and double-click the PHP editor that you want to use for adding the code.

    • 2). Retrieve the encoded URL. The following code gets the encoded URL from the user's browser and assigns it to the "URL" variable:

      $URL = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

    • 3). Insert the decoded URL into the Web page. You use the "urldecode" function to decode the new URL variable. The following code decodes the URL and inserts it as a link on the Web page:

      echo "<a href='".urldecode($URL)."'>Click here</a>";

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.