?
Solved

Get Anchors in the URL from GETENV?

Posted on 2004-11-10
12
Medium Priority
?
357 Views
Last Modified: 2008-02-26
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?

0
Comment
Question by:segmentalfault
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 27

Accepted Solution

by:
Diablo84 earned 500 total points
ID: 12550676
I don't think you can, bookmarks are handled on the client side by the browser so the anchor information is never sent to the server.
0
 
LVL 32

Expert Comment

by:ldbkutty
ID: 12550692
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.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12550708
Good idea ldbkutty, though as you say anything relative wont work as there is no request to the server.
0
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.

 
LVL 32

Expert Comment

by:ldbkutty
ID: 12550731
Anything after # is said to be a fragment identifier and IT is not consiered as a part of the URL.
0
 
LVL 10

Expert Comment

by:eeBlueShadow
ID: 12551009
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
0
 
LVL 9

Expert Comment

by:gruntar
ID: 12633222
U can't... sorry

Anchoir is internal browser variable and is not sent to server.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12824253
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 :)
0
 
LVL 1

Author Comment

by:segmentalfault
ID: 12826085
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.

0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12826128
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.
0
 
LVL 1

Author Comment

by:segmentalfault
ID: 12826773
Absolutely, I'll second the motion to change it to an A grade after reviewing the possibilities again.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

839 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