Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!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 09:56:57 +0200 Lines: 44 Message-ID: <55599B49.7050802@arnowelzel.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: individual.net C0d5UItAzUjxI9WdDp8gSQD/DrWDnbMSiP5Q04v6n7NpF4vbW8 Cancel-Lock: sha1:1NLFcVn1iXv0D9IICf4mUwYXRYg= In-Reply-To: Xref: csiph.com comp.lang.php:15334 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 > > Example: > > Server have url: http://server.com/test.html > > And client (client.com) get contents: > > file_get_contents('http://server.com/test.html') > > On server.com i need echo the client host (client.com) > > How to? You can use phpinfo() to check what environment variables are set by the server. Likely you can use $_SERVER['REMOTE_ADDR'] and nslookup() to get the host name: BTW: On this method is also used to get the host name for the IP address of the visitor (along with some other checks for proxies). -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de