Jump to content

Getting the full url/query string with php


hellonoko

Recommended Posts

There is no set variable that holds the entire URL. However in order to get the entire URL you will need to "stitch" several seperate variables together. Here's an example:

 

<?php

$myURL = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];

echo $myURL;

?>

Link to comment
Share on other sites

That works better but still does not pick up tags.

 

I was working with this:

 

<script type="text/javascript">

varURL = window.location.href;

window.location.href = varURL + "?URL=" + varURL; 

</script>


<?php

echo $_GET['URL'];

?>

 

 

But it does not quite work right.

 

I am quite sure how to tweak it to make it do what i want.

 

-ian

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.