On Sun, Aug 29, 2010 at 06:04:23PM +0200, Per Jessen wrote:

> Jason Pruim wrote:
> 
> > My understanding of how shared hosting works would make this near
> > impossible... Basically Apache grabs a header that is sent at the
> > initial connection which includes the destination hostname and from
> > there it translates it to the proper directory on the shared host.
> >
> > All the IP's though are based off of the parent site's server...
> > 
> > Now with dedicated hosting where you have the entire machine you can
> > do what you are looking at because the IP address will always
> > translate back to your website.
> 
> AFAICT, Tedd was not asking about the server, he's asking about the
> client. 

No, he's talking about the server. But the server he's using may offload
the processing of a script to another machine. So

$_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME']

both relate to the server which the client is originally communicating
with. But he wants to know if he can get the same information about a
different remote server which is processing a script for him. The
problem is that we have:

$_SERVER['REMOTE_ADDR']

but no

$_SERVER['REMOTE_NAME']

So the question is, how would he get that last variable. It becomes
complicated when using a shared hosting environment, because server
names and IPs aren't a 1:1 mapping. An IP may represent numerous actual
site names. This was part or all of the reason why the http protocol was
revised from 1.0 to 1.1-- in order to accommodate all the domains, which
because of the cramped IP space of IPv4, had to share IPs. So in the
HTTP 1.1 protocol, there is additional information passed about the name
of the domain.

Paul


-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to