How to get the URL of the current web page in PHP

2 Answers

0 votes
echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";


/*
run:

http://localhost:8080/test.php

*/

 



answered Jul 13, 2015 by avibootz
edited Jul 23, 2015 by avibootz
0 votes
echo '<input type="text" id="input-text-id" 
                         name="current-url" 
                         size="100" maxlength="300" 
                         value="http://'."$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]".'">';

/*
run:

http://localhost:8080/test.php

*/

 



answered Aug 12, 2015 by avibootz

Related questions

2 answers 320 views
1 answer 230 views
1 answer 190 views
2 answers 247 views
1 answer 262 views
1 answer 180 views
180 views asked Sep 13, 2019 by avibootz
...