Solved

Get the current url with query strings PHP

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

I tried  PHP_SELF didn't work :(
0
Comment
Question by:sahanz
  • 3
  • 2
6 Comments
 
LVL 31

Expert Comment

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

Author Comment

by:sahanz
ID: 33439632
$_SERVER['PHP_SELF']
0
 
LVL 83

Accepted Solution

by:
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.
$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 250 total points
ID: 33439639
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
 
LVL 1

Author Closing Comment

by:sahanz
ID: 33439644
Its apache and $_SERVER['REQUEST_URI'] gives the URL with query
0
 
LVL 1

Author Comment

by:sahanz
ID: 33439647
and thanks btw :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now