Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15310 > unrolled thread
| Started by | alissonlinneker@gmail.com |
|---|---|
| First post | 2015-05-11 17:10 -0700 |
| Last post | 2015-05-18 11:30 -0400 |
| Articles | 3 on this page of 23 — 12 participants |
Back to article view | Back to comp.lang.php
[ 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
Page 2 of 2 — ← Prev page 1 [2]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-05-18 15:58 +0200 |
| Message-ID | <2141060.glS3abRQ9P@PointedEars.de> |
| In reply to | #15337 |
Arno Welzel wrote: > Am 2015-05-18 um 15:26 schrieb Thomas 'PointedEars' Lahn: >> $_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 > <cdd30e0e-1570-4ccf-bc50-7d35ac9a32c0@googlegroups.com>: > > "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. Not necessarily. However, that is what API keys are for. You do _not_ simply allow everyone on the Net to run any programs on your server. -- PointedEars Zend Certified PHP Engineer Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Date | 2015-05-18 09:53 -0500 |
| Message-ID | <slrnmljv77.47h.hellsop@nibelheim.ninehells.com> |
| In reply to | #15336 |
On Mon, 18 May 2015 15:26:34 +0200, Thomas 'PointedEars' Lahn wrote:
> 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.
You missed the context entirely, Sparky.
OP an API to other websites as a paid service. He wants to validate
that requests hitting his API engine from from paying customers. He
wanted to use the domain of the IP address, but has since learned that
that unreliables and the recommendation of including a validation
key/password as part of the API request may have to do has been floated.
--
48. I will treat any beast which I control through magic or technology
with respect and kindness. Thus if the control is ever broken, it
will not immediately come after me for revenge.
--Peter Anspach's list of things to do as an Evil Overlord
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2015-05-18 11:30 -0400 |
| Message-ID | <iAn6x.44531$%r.25650@fx24.iad> |
| In reply to | #15334 |
On Monday May 18 2015 03:56, in comp.lang.php, "Arno Welzel"
<usenet@arnowelzel.de> wrote:
> 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:
>
> <?php
> if(isset($_SERVER['REMOTE_ADDR']))
> {
> $hostname = nslookup($_SERVER['REMOTE_ADDR']);
> }
> else
> {
> $hostname = '(unknown)';
> }
> ?>
>
> BTW: On <http://arnowelzel.de/wp/en/tools/http-request-headers> this
> method is also used to get the host name for the IP address of the
> visitor (along with some other checks for proxies).
Be aware that, if the client side runs on an IP address shared by multiple
FQDNs, nslookup may not provide the exact client FQDN that the OP expects.
For instance, "Big Company" (big.co) has subsidiaries "Small Company"
(small.co) and "Bigger Company" (bigger.co), and has configured their DNS to
provide names in each of these domains for each public IP address.
Client works for "Small Company", and typically refers to his workstation
address as client.small.co. nslookup() on his IP address /may/ return the
FQDN of client.big.co or client.bigger.co.
This is more observable when using external hosting services, where each
client's system is actually virtualized on a single machine (think how most
web hosting companies work); "Big Company" and all it's subsidiaries may
share IP addresses with hundreds, if not thousands of other domains, each of
which has a FQDN.
Just say'n
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.php
csiph-web