The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
How to get the "real" URL?
Discuss How to get the "real" URL? in the PHP Development forum on Dev Shed. How to get the "real" URL? PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 9th, 2000, 12:22 PM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 18
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
I've been twisting my mind trying to figure out how to get the real URL. I have a page at namezero which requires you to have a frame_banner at the bottom of the page, thus making it impossible to enter direct URL-adresses. E.g. http://www.metusmortuus.net and http://www.metusmortuus.net/samples.html will both end up at the same page, namely the page that this virtual domain is pointing to. (I hope you understand this)
What I need is to find the actual URL that was typed into the 'location'-box. Then I would be able to simply redirect my visitors to that page manually. (Yikes, this was hard to describe, but I hope you get the picture)
None of the predefined variables listed in phpinfo() worked (incl. request_uri and http_referrer), so I guess this is a long shot...
|

July 9th, 2000, 02:05 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
I understand what you mean, and I think I could do it with perl (cgi), but I'm not that versed in PHP to do tricks like that.
|

July 9th, 2000, 02:48 PM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Try using the $HTTP_HOST function, eg
<?php
echo $HTTP_HOST;
?>
Coopers http://www.phatwap.co.uk
|

July 10th, 2000, 08:04 AM
|
|
Contributing User
|
|
Join Date: Apr 1999
Posts: 114
Time spent in forums: 42 m 44 sec
Reputation Power: 15
|
|
|

July 10th, 2000, 02:27 PM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 18
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Like I said, none of the variables listed in phpinfo() works... incl. http_host, phpself etc. etc... The HTML file itself resides on a different server, and what I need is the virtual URL... I really don't think it's possible :-(
|

July 10th, 2000, 04:24 PM
|
|
PHP Developer
|
|
Join Date: Dec 1999
Location: EU.NL
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
You could try it with JavaScript, but I think you'll get access-errors...
I've got a similar situation myself, but haven't addressed the problem yet.
I'll try to come up with something later this week, and if it works, I'll post a solution here...
------------------
Have Fun !
SJONdaMON
SDO
|

July 11th, 2000, 09:28 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Try REQUEST_URI. I this should be the URI that the visitor typed in.
|

July 11th, 2000, 11:02 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 18
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
To explain this a little further. My page is loaded inside a frame (classic URL cloaking) and the frame belongs to the providers of the Domain-forwarding-provider. So request_url would work in the frame (which I don't have access to), but not in my page (which reflects the server that the file is actually stored at)
That's why this seems hopeless, but the URL remains in the location window (where you type in URL's) so I'm wondering if it's possible to get it in any other way. Like I said 2 times allready, none of the variables in phpinfo() works (which includes all suggestions so far)
|

July 11th, 2000, 11:10 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
OKay, well here's a thought, if you are working with a framed document and you want to preven access to a specific frame etc, why not try checking http referrer, look for whatever url you are after.. parse_url() can be set to readily check the referrer, for the specific, if it doesn't match bounce them with a header() call to whatever url you want them to enter from.
in short, for using http referrer you grab their referrer, and then point them to the main page "if" the referrer doesn't match that page.. etc.
------------------
SnR Graphics,
Low Cost Hosting and Web Development.
|

July 11th, 2000, 05:31 PM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I'm kinda confused here but maybe this is what your looking for. I'm under the impression you want to get rid of the banner advertisement, so why not use javascript? Just add this code under <./head> [i put the period in case this strips out HTML]...
<script language="javascript">
<!--
if (top.frames.length != 0)
{
top.location=document.location
}
//-->
</script>
That will reload your page in the window, and you wont have the frames...
Hopes thats helps...
-Bryan
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|