Get the current url with query strings PHP

Posted on 2010-08-15
Last Modified: 2012-05-10
How to get the current url with query strings?

I tried  PHP_SELF didn't work :(
Question by:sahanz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 31

Expert Comment

by:Marco Gasi
ID: 33439631
What have you done, exactly? PHP_SELF or $_SERVER['PHP_SELF']?

Author Comment

ID: 33439632
LVL 83

Accepted Solution

Dave Baldwin earned 250 total points
ID: 33439637
Looks like on this Windows IIS machine you need two $_SERVER variables to get everything.  Looks like that should work on Linux/Apache also.

Open in new window

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 250 total points
ID: 33439639
Take a look at this function

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

Hope this helps

Author Closing Comment

ID: 33439644
Its apache and $_SERVER['REQUEST_URI'] gives the URL with query

Author Comment

ID: 33439647
and thanks btw :)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can't Find the Homepage on my site 4 46
Form not executing correctly 1 26
Select Query Fails in PHP but not in TERMINAL Mysql 9 30
php time 12 24
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question