2

My URL looks like this:

http://mydomain.com/reader/index.php?type=numerated&id=28&m=2#page/6/mode/2up

How can I get it like variable? Using "standard" PHP codding, I don't know how to get part with page/6/mode/2up

Looks like minor problem, but I was not able to get solution... Thank you in advance!

2
  • You can't, because in most cases the browser doesn't pass the # or anything after it to the server Commented May 14, 2012 at 19:53
  • 1
    If you're asking about parsing that url as a string this question should help. Commented May 14, 2012 at 19:54

1 Answer 1

5

The part after # is a client-side part of the URL, it refers to an anchor within the HTML. Therefore, you can only retrieve everything before that.

Clients are not supposed to send URI-fragments to servers when they retrieve a document, and without help from a local application fragments do not participate in HTTP redirections.

~ Wikipedia: http://en.wikipedia.org/wiki/Fragment_identifier


To retrieve everything else, you can use this code:

$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.