Skip to content

Instantly share code, notes, and snippets.

@rajvanshipradeep15
Created February 1, 2017 07:17
Show Gist options
  • Save rajvanshipradeep15/107f3d6b20e6a8adfaacaca4f5b69e23 to your computer and use it in GitHub Desktop.
Save rajvanshipradeep15/107f3d6b20e6a8adfaacaca4f5b69e23 to your computer and use it in GitHub Desktop.
get current url
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo $url; // Outputs: Full URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment