Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: [ Get Hostname ] Date: Mon, 18 May 2015 15:53:50 +0200 Lines: 51 Message-ID: <5559EEEE.5080000@arnowelzel.de> References: <55599B49.7050802@arnowelzel.de> <55599D06.7080208@arnowelzel.de> <1865910.lMKXOGlSMj@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net HcinbpA0DRgd22lOFXI1cATakfg2Mci0t3fr9xQYPigZ9oNelh Cancel-Lock: sha1:SqzbLjM3aIe5AnvW0wy/DcC86Uc= In-Reply-To: <1865910.lMKXOGlSMj@PointedEars.de> Xref: csiph.com comp.lang.php:15337 Am 2015-05-18 um 15:26 schrieb Thomas 'PointedEars' Lahn: > 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 [...] I assumed the "client" is in fact a *server* which uses PHP to fetch content from another server - and as the OP explained in : "I'm trying to identify the domain that is carrying out consultations in my API. The API is limited by domain, so I need to know which domain came the query" So I hope it's clear that we are not talking about clients using their dial-up-connections to run PHP scripts accessing the OPs web 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. See above. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de