Thursday, August 30, 2012

How to get full URL in PHP

To get full url of running script, we use the following two functions in PHP


Consider my url string is :

<?php echo $_SERVER['HTTP_HOST']; ?>

Output :


Output : /products/booking.php

<?php echo 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);?>

Output :

1 comment:

Ellen Paul said...

The Blog you are running is just awesome. The stuff and theme of the blog is so impressive. The actual match, like your blog, is found on very rare places. This blog is so clear and simple, there is no useless content you have added just to show a fake knowledge about the topic. I am new to blogging and picking lot from your blog. Here is my blog if you want to take a look and do suggest me if any problem or something missing.
Thanks a lot!!!