0

HEllo I have this URL I need to get with PHP

http://www.domain.com/forum/#forum/General-discussions-0.htm

The problem is this is not a real URL, but this the mask created by the .htaccess.

I need to get the visible URL and not the real path of the file, because I need to compare it with some PHP variables I have.

In fact the real path will look like this:

http://domain.com/modules/boonex/forum/index.php

And in that way is totally useless for me.

How do I get the first URL as it is?

DiegoP.
  • 45,177
  • 34
  • 89
  • 107
  • possible duplicate of [PHP Get the Full URL](http://stackoverflow.com/questions/6768793/php-get-the-full-url). please edit your original question instead of posting a new one. – ax. Jul 20 '11 at 22:07
  • You....can't? You'll get whatever the server sends back a response for - it processes `.htaccess` and Apache settings before it sends back any kind of HTTP header/response. – Nightfirecat Jul 20 '11 at 22:08
  • @Nightfirecat: Same answer as I said :) :p – genesis Jul 20 '11 at 22:09

3 Answers3

2

You can't get that from http://www.domain.com/forum/#forum/General-discussions-0.htm. Everything after the fragment (#) is not even send to the server, there is no way to retrieve it save for a delayed update with javascript. All you'll get it is http://www.domain.com/forum/ send to the server, and on the onload event of your document you can possibly load something in with javascript.

Wrikken
  • 69,272
  • 8
  • 97
  • 136
1

Look into the source code or it may not have real urls at all. The part is for ajax based navigation. It may mean that there are no real urls on that site and if there are then they should be extracted from <a href="someurl"> as they might masked using javascript.

Vish
  • 4,508
  • 10
  • 42
  • 74
0

With

file_get_contents(); 

for example. Neither user nor your server mind about .htaccess It's server proccessing the request who have to direct you to correct address

however php does ignore everything after #, so in this case you have no chance to get it without real url

As @Wrikken said, there is no way to get url after # fragment

genesis
  • 50,477
  • 20
  • 96
  • 125
  • I'd +1 this, but I'm out of votes for the day. 2 hours from now, though, it will be done! – Nightfirecat Jul 20 '11 at 22:10
  • file_get_contents("http://url.to/file"); however php does ignore everything after # – genesis Jul 20 '11 at 22:12
  • @Nightfirecat: Dammit :( Even with your vote, I would not receive reputation as I received 200+ today already. You can try it tomorrow if you remember :p – genesis Jul 20 '11 at 22:14