Connecting Tech Pros Worldwide Help | Site Map

Get content of URL after #

  #1  
Old July 17th, 2005, 01:30 AM
Tim Tyler
Guest
 
Posts: n/a
A simple question:

If my PHP page is referenced thus: foo.php#bar

....what's the best way of getting the contents of the URL
after the hash - as a string ("bar")?

Should I get the URL, look for the "#" and then use
substring()?

I'd prefer something like:

$H = $_GET['#']; // reaching...
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
  #2  
Old July 17th, 2005, 01:30 AM
Andy Hassall
Guest
 
Posts: n/a

re: Get content of URL after #


On Sun, 12 Oct 2003 19:42:20 GMT, Tim Tyler <tim@tt1lock.org> wrote:
[color=blue]
>A simple question:
>
>If my PHP page is referenced thus: foo.php#bar
>
>...what's the best way of getting the contents of the URL
>after the hash - as a string ("bar")?
>
>Should I get the URL, look for the "#" and then use
>substring()?
>
>I'd prefer something like:
>
>$H = $_GET['#']; // reaching...[/color]

You can't; it's not passed to the server.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
  #3  
Old July 17th, 2005, 01:30 AM
Tim Tyler
Guest
 
Posts: n/a

re: Get content of URL after #


Andy Hassall <andy@andyh.co.uk> wrote or quoted:[color=blue]
> On Sun, 12 Oct 2003 19:42:20 GMT, Tim Tyler <tim@tt1lock.org> wrote:[/color]
[color=blue][color=green]
>>A simple question:
>>
>>If my PHP page is referenced thus: foo.php#bar
>>
>>...what's the best way of getting the contents of the URL
>>after the hash - as a string ("bar")? [...][/color]
>
> You can't; it's not passed to the server.[/color]

So it isn't ;-)

On reflection, $_SERVER['REQUEST_URI']; gives me close enough to
what I am after. Thanks for the "#" advice.
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
  #4  
Old July 17th, 2005, 01:31 AM
Craig Keightley
Guest
 
Posts: n/a

re: Get content of URL after #


There is a javascript method that can get the #value

using location.hash.slice(1)


  #5  
Old July 17th, 2005, 01:32 AM
BKDotCom
Guest
 
Posts: n/a

re: Get content of URL after #


try parse_url();
http://www.php.net/manual/en/function.parse-url.php

Tim Tyler <tim@tt1lock.org> wrote in message news:<HMntEK.6ty@bath.ac.uk>...[color=blue]
> A simple question:
>
> If my PHP page is referenced thus: foo.php#bar
>
> ...what's the best way of getting the contents of the URL
> after the hash - as a string ("bar")?
>
> Should I get the URL, look for the "#" and then use
> substring()?
>
> I'd prefer something like:
>
> $H = $_GET['#']; // reaching...[/color]
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get text content of a div with YAHOO Dom.getFirstChild(div)? david.karr answers 4 June 27th, 2008 08:12 PM
Getting the content of a URL, after DOM processing and javascript noama answers 0 August 27th, 2007 02:44 PM
correctly getting utf8 characters in the content of an e-mail lionel answers 2 August 11th, 2007 11:35 AM
Get HTML Content of a Local Page Sam answers 3 November 28th, 2006 09:55 PM