From: tedd on
Hi gang:

The server global:

$_SERVER['SERVER_ADDR']

Provides the IP of the server where the current script is executing.

And, the server global:

$_SERVER['REMOTE_ADDR']

Provides the IP of the server executing the script.

As such, you can enter the IP of either into a browser and see that
specific domain.

However, that doesn't work when you are dealing with shared hosting.
Doing that will show you to the parent domain, but not the child
domain (i.e., alias).

So, how can I identify the exact location of the 'server_addr' and of
the 'remote_addr' on shared hosting? Is that possible?

Thanks,

Cheers,

tedd

--
-------
http://sperling.com/
From: Per Jessen on
tedd wrote:

> Hi gang:
>=20
> The server global:
>=20
> $_SERVER['SERVER_ADDR']
>=20
> Provides the IP of the server where the current script is executing.
>=20
> And, the server global:
>=20
> $_SERVER['REMOTE_ADDR']
>=20
> Provides the IP of the server executing the script.

Yes, aka the client address.=20

> As such, you can enter the IP of either into a browser and see that
> specific domain.

Huh? If my server is 192.168.29.104 and my client is 192.168.29.114, I=

might get the default website on the server address, and nothing on the=

client (assuming it is not running a webserver).

> However, that doesn't work when you are dealing with shared hosting.
> Doing that will show you to the parent domain, but not the child
> domain (i.e., alias).
>=20
> So, how can I identify the exact location of the 'server_addr' and of=

> the 'remote_addr' on shared hosting? Is that possible?

$_SERVER['SERVER_NAME'] will tell you the name of the virtual host - I
don't know if that is what you're after.



--=20
Per Jessen, Z=C3=BCrich (12.2=C2=B0C)

From: tedd on
At 9:41 PM +0200 8/28/10, Per Jessen wrote:
>tedd wrote:
> >
>> So, how can I identify the exact location of the 'server_addr' and of
>> the 'remote_addr' on shared hosting? Is that possible?
>
>$_SERVER['SERVER_NAME'] will tell you the name of the virtual host - I
>don't know if that is what you're after.
>
>--
>Per Jessen, Zürich (12.2°C)

Certainly, $_SERVER['SERVER_NAME'] will tell you
the name of the virtual host, but what about the
virtual remote?

You see, I can have a script on one server
communicate with another script on a another
server and the remote addresses reported on
either will not translate back to their
respective virtual hosts, but instead to their
hosts.

So, I'm trying to figure out a compliment to
$_SERVER['SERVER_NAME'] such as something like
$_SERVER['REMOTE_NAME'].

Is there such a beast?

Cheers,

tedd

--
-------
http://sperling.com/
From: Peter Lind on
On 28 August 2010 23:45, tedd <tedd.sperling(a)gmail.com> wrote:
> At 9:41 PM +0200 8/28/10, Per Jessen wrote:
>>
>> tedd wrote:
>>  >
>>>
>>>  So, how can I identify the exact location of the 'server_addr' and of
>>>  the 'remote_addr' on shared hosting? Is that possible?
>>
>> $_SERVER['SERVER_NAME'] will tell you the name of the virtual host - I
>> don't know if that is what you're after.
>>
>> --
>> Per Jessen, Zürich (12.2°C)
>
> Certainly, $_SERVER['SERVER_NAME'] will tell you the name of the virtual
> host, but what about the virtual remote?
>
> You see, I can have a script on one server communicate with another script
> on a another server and the remote addresses reported on either will not
> translate back to their respective virtual hosts, but instead to their
> hosts.
>
> So, I'm trying to figure out a compliment to $_SERVER['SERVER_NAME'] such as
> something like $_SERVER['REMOTE_NAME'].
>
> Is there such a beast?
>

You're not making any sense. For the script on your local host to be
able to connect and communicate with the remote host, it would need to
know the name of the remote host. Hence, the local host already knows
the name and has no reason to ask the remote host for a name by which
to contact it.
That's what I get from your description of the problem. You probably
want to clarify some things.

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>
From: tedd on
At 12:15 AM +0200 8/29/10, Peter Lind wrote:
>On 28 August 2010 23:45, tedd <tedd.sperling(a)gmail.com> wrote:
>
> > So, I'm trying to figure out a compliment to
>$_SERVER['SERVER_NAME'] such as
>> something like $_SERVER['REMOTE_NAME'].
>>
> > Is there such a beast?
>
>You're not making any sense. For the script on your local host to be
>able to connect and communicate with the remote host, it would need to
>know the name of the remote host. Hence, the local host already knows
>the name and has no reason to ask the remote host for a name by which
>to contact it.
> That's what I get from your description of the problem. You probably
>want to clarify some things.
>
>Regards
>Peter

Peter:

Sorry for not making sense. But sometimes you have to confirm the
players (both server and remote) in communications.

Try this -- place this script on your site:

<?php
print_r($_SERVER);
?>

You will note that:

[SERVER_NAME] => is the domain name of your site.

Also:

[SERVER_ADDR] => is the IP of your site. If you are on a shared host,
then it will still be the IP of the main host.

Please note:

[REMOTE_ADDR] => is the IP of the remote server. It *will be* the IP
of the remote main host regardless of if the requesting script is
running on the remote main host OR is running under a remote shared
host.

Here's an example:

My site http://webbytedd.com is running on a shared host.

The server address reported for this site is: 74.208.162.186

However, if I enter 74.208.162.186 into a browser, I do not arrive at
webbytedd.com, but instead go to securelayer.com who is my host.

Now, if webbytedd.com was the requesting script, how could the
original script know what domain name the request came from? As it is
now, it can only know the main host ID, but not the domain name of
the requesting script. Does that make my question any clearer?

So my questions basically is -- how can I discover the actual domain
name of the remote script when it is running on a shared server?

I hope that makes better sense.

Cheers,

tedd

--
-------
http://sperling.com/