[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

grab the entire current URL with its parameters

Hi

I want to be able to grab the entire current URL (including all parameters such as below) and make it html safe (eg & to &) how can I do this please?

Neil

http://www.test.gov.uk/index2.php?option=com_rss&feed=ATOM1.0&no_html=1
0
Neil Thompson
Asked:
Neil Thompson
  • 2
1 Solution
 
KennyTMCommented:
$url = 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') + 1); // <-- retrieve the URL.

echo htmlspecialchars ($url); // <-- make it "HTML safe".
0
 
KennyTMCommented:
Sorry, the first line should be

$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
0
 
alain34Commented:
You should look at htmlentities at http://uk2.php.net/manual/en/function.htmlentities.php
0
 
Neil ThompsonSenior Systems DeveloperAuthor Commented:
thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now