Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #15336

Re: [ Get Hostname ]

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: [ Get Hostname ]
Date Mon, 18 May 2015 15:26:34 +0200
Organization PointedEars Software (PES)
Lines 41
Message-ID <1865910.lMKXOGlSMj@PointedEars.de> (permalink)
References <ad6347be-372c-4f89-9511-2c0ebb989a0e@googlegroups.com> <55599B49.7050802@arnowelzel.de> <55599D06.7080208@arnowelzel.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1431955758 21360 eJwNxMEBADEEBMCWCLu0I0j/JdzNY2BUdjhBx8OL8y8aIauXHHp3ljxbw+nrCR9YbtZULOUDDGUQ0w== (18 May 2015 13:29:18 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 18 May 2015 13:29:18 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwFwYEBwDAEBMCViHgyjvL2H6F3blB0XDiur29kyUDZ3gtDprkJla+GWNrwq5rqHJQ0n9s+pDSwRzvOD3FlFl4=
Cancel-Lock sha1:BDvP3QFhHsr3n7bScuBNACVYudo=
X-NNTP-Posting-Host eJwNwoENwDAIA7CXBiRpe86Cxv8ndJZZCvWCKHA45k78y3wK6ZFihxHNVCDP+uKMM+F+p+YC9mkQNQ==
Xref csiph.com comp.lang.php:15336

Show key headers only | View raw


Arno Welzel wrote:

> Am 2015-05-18 um 09:56 schrieb Arno Welzel:
>> Am 2015-05-12 um 02:10 schrieb alissonlinneker@gmail.com: 
>>> How do I get file_get_contents return the client domain that is
>>> referring to the url?
>>>
>>> $ _SERVER ["REMOTE_ADDR"] is returning the shared hosting DNS reverse
>>> and not site.com
> [...]
> 
> Sorry - I overlooked this part of your question.
> 
> In fact this problem can not be solved as it is a very common usual way
> to host web sites - one IP address any many domains which resolve to
> this address but the host name of the provider for DNS reverse.

Ex falso quodlibet.

$_SERVER['REMOTE_ADDR'], as it is correctly written (no space in-between, 
certainly not after “$”), is almost never “returning the shared hosting DNS 
reverse”.  It yields the external *IP address* of the *client*, not the 
server.  Usually that means that it is the *dial-up* _IP address_ assigned 
by an ISP to the household of a customer (or one of the customer’s machines 
with IPv6-only).  Reverse DNS lookup on that address *may* then yield the 
temporary hostname of the client as assigned by the ISP.

This is not to be confused with $_SERVER['SERVER_ADDR'] whose value is the 
IP address assigned to the Web server for the request.  Reverse DNS lookup 
on *that* address could either yield a multitude of domains on server with 
shared Web hosting or the pseudo-domain of a virtual server.

It does not make any sense for a server-side PHP script to get “the client 
domain”.  What does the OP hope to accomplish?  They seem to be having an
X–Y problem.

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[ Get Hostname ] alissonlinneker@gmail.com - 2015-05-11 17:10 -0700
  Re: [ Get Hostname ] "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-05-12 02:33 +0200
    Re: [ Get Hostname ] alissonlinneker@gmail.com - 2015-05-11 17:38 -0700
      Re: [ Get Hostname ] Jerry Stuckle <jstucklex@attglobal.net> - 2015-05-11 20:55 -0400
  Re: [ Get Hostname ] gordonb.rtzee@burditt.org (Gordon Burditt) - 2015-05-12 01:22 -0500
    Re: [ Get Hostname ] Matthew Carter <m@ahungry.com> - 2015-05-12 09:38 -0400
      Re: [ Get Hostname ] alissonlinneker@gmail.com - 2015-05-12 12:28 -0700
        Re: [ Get Hostname ] Jerry Stuckle <jstucklex@attglobal.net> - 2015-05-12 17:09 -0400
          Re: [ Get Hostname ] alissonlinneker@gmail.com - 2015-05-12 14:12 -0700
            Re: [ Get Hostname ] Matthew Carter <m@ahungry.com> - 2015-05-12 18:31 -0400
            Re: [ Get Hostname ] Jerry Stuckle <jstucklex@attglobal.net> - 2015-05-12 21:52 -0400
        Re: [ Get Hostname ] gordonb.6xh3q@burditt.org (Gordon Burditt) - 2015-05-13 18:25 -0500
      Re: [ Get Hostname ] Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-13 20:37 +0200
  Re: [ Get Hostname ] Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-12 12:09 +0000
  Re: [ Get Hostname ] alissonlinneker@gmail.com - 2015-05-12 17:13 -0700
    Re: [ Get Hostname ] Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-05-13 18:09 +0200
  Re: [ Get Hostname ] Arno Welzel <usenet@arnowelzel.de> - 2015-05-18 09:56 +0200
    Re: [ Get Hostname ] Arno Welzel <usenet@arnowelzel.de> - 2015-05-18 10:04 +0200
      Re: [ Get Hostname ] Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-18 15:26 +0200
        Re: [ Get Hostname ] Arno Welzel <usenet@arnowelzel.de> - 2015-05-18 15:53 +0200
          Re: [ Get Hostname ] Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-18 15:58 +0200
        Re: [ Get Hostname ] "Peter H. Coffin" <hellsop@ninehells.com> - 2015-05-18 09:53 -0500
    Re: [ Get Hostname ] Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-05-18 11:30 -0400

csiph-web