Link to home
Start Free TrialLog in
Avatar of segmentalfault
segmentalfaultFlag for Canada

asked on

Get Anchors in the URL from GETENV?

I understand GETENV('REQUEST_URI') returns the URL provided to access the current .php page.  However, how do I retrieve the anchors?  i.e.

http://somedomain.com/#someanchor

REQUEST_URI does not include the #someanchor.  What's the simple way of finding the anchors?

ASKER CERTIFIED SOLUTION
Avatar of Diablo84
Diablo84

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes, though like this is possible:

<?php
   print_r(parse_url('http://localhost:81/tests/test.php?something=23#hai'));
?>

but you cannot use it for 'relative' URL.
Avatar of Diablo84
Diablo84

Good idea ldbkutty, though as you say anything relative wont work as there is no request to the server.
Anything after # is said to be a fragment identifier and IT is not consiered as a part of the URL.
You can see exactly what variables are availble by making a phpinfo() page called, for example phpinfo.php and then visiting http://www.yoursite.com/phpinfo.php?someGet=info#anchoir
U can't... sorry

Anchoir is internal browser variable and is not sent to server.
When this is handled by cleanup could the accepted answer either be changed to ldbkutty {http:#12550692} - this is the nearest thing there is to getting the anchor server side - or can the accepted answer be removed from my comment. I do not particularly want a C grade in my profile. Thank you :)
Avatar of segmentalfault

ASKER

If you're worried about it, the admin can change it to A.  I just figured the answer wasn't worth an A grade.  But after reviewing the possible answers, there probably wasn't much to go on anyhow.

segmentalfault, its not a problem i just i don't really want a C grade in my profile. Sometimes answers are not the answer you wanted to hear, particularly in the case of "not possible" situations, but in these cases if it's not possible the answer can't go into much more detail other then the fact that’s it can't be done and why it can't be done. In this case its a limited one because anchors are handled client side for the best part.

I see your point though, this isn't much of an A grade question/answer combination so perhaps a B will be more fitting. I will have CS take a look at it. Thank you for your co-operation.
Absolutely, I'll second the motion to change it to an A grade after reviewing the possibilities again.