Forum Moderators: coopster
For ex. There are two websites names with the same IP Address and their google keys to display the maps.
www.example1.com, Google Key (aaaaaaaaa)
www.example2.com Google Key (bbbbbbbbb)
Both the websites are directed to the same domain.
I want to have option on the webpage that when the webaddress is www.example1.com use its Key
else
if it is www.example2.com, use the other key.
How do I capture the website name.
[edited by: eelixduppy at 7:00 pm (utc) on Oct. 8, 2007]
[edit reason] changed to example.com [/edit]
$keys = array('www.example1.com' => 'aaaaaaaa', 'www.example2.com' => 'bbbbbbb');
// assuming the link is coming from some sort of form with POST
if (array_key_exists($_POST['website'], $keys) === true) {
$google_key = $keys[$_POST['website'];
}
// do whatever you want with your google key.
Both the websites are directed to the same domain.
www.example1.com
www.example2.com
Actually, those are two different domains, not the same. They may have the same IP address, but definitely two completely different domains.
Either way, you might find your answer in the $_SERVER superglobal. Run this script on your site to determine:
<pre>
<?php
print_r($_SERVER);
?>
<pre>
But the website name is - coming from what we write in the browser address bar.
This is what I dont get.
As if they are on your site then type www.example1.com into the browser address bar they will do to that site...so unless it is your site there is nothing that you can do, as they will no longer be on your site.
I assume that im just being dumb.
If they are referring in to you then you may be able to use the $_SERVER['HTTP_REFERER'] to get what you want, although this isnt always reliable.