Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get the current url with query strings PHP

Posted on 2010-08-15
6
Medium Priority
?
285 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 84

Accepted Solution

by:
Dave Baldwin earned 1000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
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.
Suggested Courses

916 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