PHP Get Current URL

Get the current URL. Use it with social widgets that require the web page's URL

Usage

To get the full URL, including the domain part:


echo get_current_url();

To get just the URL for internal use:

echo get_current_url(false);


This function will also work for HTTPS and non-standard ports.

S.

 

Comments

Posted on 24.01.2011 13:04 by guest

far too simple. Request URI isn't always available. It's uncommon for it to be missing but does happen