Get the current url with query strings PHP

How to get the current url with query strings?

I tried  PHP_SELF didn't work :(
LVL 1
sahanzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Looks like on this Windows IIS machine you need two $_SERVER variables to get everything.  Looks like that should work on Linux/Apache also.
$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]

Open in new window

0
 
Marco GasiFreelancerCommented:
What have you done, exactly? PHP_SELF or $_SERVER['PHP_SELF']?
0
 
sahanzAuthor Commented:
$_SERVER['PHP_SELF']
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
Marco GasiConnect With a Mentor FreelancerCommented:
Take a look at this function http://www.webcheatsheet.com/PHP/get_current_page_url.php

You can also use $_SERVER['REQUEST_URI'] but I'm not sure (never used :-))

Hope this helps
0
 
sahanzAuthor Commented:
Its apache and $_SERVER['REQUEST_URI'] gives the URL with query
0
 
sahanzAuthor Commented:
and thanks btw :)
0
All Courses

From novice to tech pro — start learning today.