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;

?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.