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 | 20 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 1 of 2 [1] 2 Next page →
| From | alissonlinneker@gmail.com |
|---|---|
| Date | 2015-05-11 17:10 -0700 |
| Subject | [ Get Hostname ] |
| Message-ID | <ad6347be-372c-4f89-9511-2c0ebb989a0e@googlegroups.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?
[toc] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-05-12 02:33 +0200 |
| Message-ID | <mirhou$ts7$1@solani.org> |
| In reply to | #15310 |
alissonlinneker@gmail.com wrote:
> 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 try $_SERVER['HTTP_REFERER'].
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | alissonlinneker@gmail.com |
|---|---|
| Date | 2015-05-11 17:38 -0700 |
| Message-ID | <f29f243c-60f4-4446-aa4c-440f01d44afe@googlegroups.com> |
| In reply to | #15311 |
Em segunda-feira, 11 de maio de 2015 21:33:39 UTC-3, Christoph M. Becker escreveu:
> alissonlinneker@gmail.com wrote:
>
> > 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 try $_SERVER['HTTP_REFERER'].
>
> --
> Christoph M. Becker
Empty result
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2015-05-11 20:55 -0400 |
| Message-ID | <miriv5$o6i$1@dont-email.me> |
| In reply to | #15312 |
On 5/11/2015 8:38 PM, alissonlinneker@gmail.com wrote:
> Em segunda-feira, 11 de maio de 2015 21:33:39 UTC-3, Christoph M. Becker escreveu:
>> alissonlinneker@gmail.com wrote:
>>
>>> 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 try $_SERVER['HTTP_REFERER'].
>>
>> --
>> Christoph M. Becker
>
> Empty result
>
By "client host" I am assuming you are referring to a server with a link
to your page (i.e. <a href="example.com/test.html">...</a>). If so,
$_SERVER['HTTP_REFERER'] is the correct value to use (ensure you have
the spelling correct!). But beware - it is an optional field - it
doesn't have to be filled in by the browser (which is what actually
sends the data to your server). Additionally, some tools will strip
this from the request. If it's not there, there is no way you can tell
where the request came from.
If you're talking about something else, please clarify what you want.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | gordonb.rtzee@burditt.org (Gordon Burditt) |
|---|---|
| Date | 2015-05-12 01:22 -0500 |
| Message-ID | <RYmdnYQm5IakAczInZ2dnUU7-N-dnZ2d@posted.internetamerica> |
| In reply to | #15310 |
alissonlinneker@gmail.com wrote:
> 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?
So, the user's browser (which need not have any DNS associated with
its IP address) connects to site A with a request for a page. As
part of that page, site A scrapes content from site B, a move which
seems to have copyright infringement as its only logical goal (unless
sites A and B have a common owner or an agreement to allow this),
and sends the contents back to the user's browser.
Site A may host a lot of domains (10,000 being a practical maximum,
I think). It may have 1 IP address, or one IP address for each
virtual site it hosts (way back when browsers that didn't support
HTTP/1.1 and the Host: header, this was needed. Do people bother
with this any more?). However, even if it has 1 IP address per
virtual site, it need not use that IP address as the source address
for the request to Site B.
So you want to find every DNS A or AAAA record (and possibly include
CNAME records) that points at the same host that has
$_SERVER["REMOTE_ADDR"] as one of its IP addresses. Then somehow
you magically narrow down the list to find the "right" entry. Doing
a DNS lookup on every possible name is going to be extremely
time-consuming (you'll die of old age first). Given that a host
has one known IP address, there's no obvious way to find all of its
other IP addresses, if any (127.0.0.1 doesn't count - it's not
usable remotely), and no particularly good reason for its administrator
to answer such a question.
In the specific case where the host has only 1 IP address and the
reverse DNS isn't a deliberate lie, you know what that address is.
You still don't know about the other 10,000 DNS A and/or CNAME
records it might have pointing at the same IP. There isn't a way
for Site B to tell what URL the user typed in his browser to contact
Site A unless Site A deliberately passes it on, say, with this
running on Site A:
file_get_contents("http://server.com/test.html?my_client_stealing_your_content_is_using_virtual_domain=$_SERVER['SERVER_NAME']");
This assumes that Site A runs a web server that supplies 'SERVER_NAME'
as the virtual host on which the PHP script is running (e.g. Apache
does).
Or have I completely misinterpreted the question?
[toc] | [prev] | [next] | [standalone]
| From | Matthew Carter <m@ahungry.com> |
|---|---|
| Date | 2015-05-12 09:38 -0400 |
| Message-ID | <87vbfx3oh4.fsf@ahungry.com> |
| In reply to | #15314 |
gordonb.rtzee@burditt.org (Gordon Burditt) writes: > So, the user's browser (which need not have any DNS associated with > its IP address) connects to site A with a request for a page. As > part of that page, site A scrapes content from site B, a move which > seems to have copyright infringement as its only logical goal (unless > sites A and B have a common owner or an agreement to allow this), > and sends the contents back to the user's browser. Granted in this case it probably is copyright infringement, but how does that work for dynamic scraping? Is every web based proxy service performing copyright infringement to serve the remote pages as-is? Are the Google Cache pages infringing on copyright? -- Matthew Carter (m@ahungry.com) http://ahungry.com
[toc] | [prev] | [next] | [standalone]
| From | alissonlinneker@gmail.com |
|---|---|
| Date | 2015-05-12 12:28 -0700 |
| Message-ID | <db5aba5d-1586-4e34-8a51-b65eadb1d460@googlegroups.com> |
| In reply to | #15316 |
Em terça-feira, 12 de maio de 2015 10:38:37 UTC-3, Matthew Carter escreveu: > gordonb.rtzee@burditt.org (Gordon Burditt) writes: > > > > So, the user's browser (which need not have any DNS associated with > > its IP address) connects to site A with a request for a page. As > > part of that page, site A scrapes content from site B, a move which > > seems to have copyright infringement as its only logical goal (unless > > sites A and B have a common owner or an agreement to allow this), > > and sends the contents back to the user's browser. > > Granted in this case it probably is copyright infringement, but how does > that work for dynamic scraping? > > Is every web based proxy service performing copyright infringement to > serve the remote pages as-is? > > Are the Google Cache pages infringing on copyright? > > -- > Matthew Carter (m@ahungry.com) > http://ahungry.com Any idea so I can verify that the client domain is client.com?
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2015-05-12 17:09 -0400 |
| Message-ID | <mitq3s$ipi$1@dont-email.me> |
| In reply to | #15317 |
On 5/12/2015 3:28 PM, alissonlinneker@gmail.com wrote: > Em terça-feira, 12 de maio de 2015 10:38:37 UTC-3, Matthew Carter escreveu: >> gordonb.rtzee@burditt.org (Gordon Burditt) writes: >> >> >>> So, the user's browser (which need not have any DNS associated with >>> its IP address) connects to site A with a request for a page. As >>> part of that page, site A scrapes content from site B, a move which >>> seems to have copyright infringement as its only logical goal (unless >>> sites A and B have a common owner or an agreement to allow this), >>> and sends the contents back to the user's browser. >> >> Granted in this case it probably is copyright infringement, but how does >> that work for dynamic scraping? >> >> Is every web based proxy service performing copyright infringement to >> serve the remote pages as-is? >> >> Are the Google Cache pages infringing on copyright? >> >> -- >> Matthew Carter (m@ahungry.com) >> http://ahungry.com > > Any idea so I can verify that the client domain is client.com? > The real question here is - what are you trying to accomplish? -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | alissonlinneker@gmail.com |
|---|---|
| Date | 2015-05-12 14:12 -0700 |
| Message-ID | <cdd30e0e-1570-4ccf-bc50-7d35ac9a32c0@googlegroups.com> |
| In reply to | #15318 |
Em terça-feira, 12 de maio de 2015 18:09:25 UTC-3, Jerry Stuckle escreveu: > On 5/12/2015 3:28 PM, alissonlinneker@gmail.com wrote: > > Em terça-feira, 12 de maio de 2015 10:38:37 UTC-3, Matthew Carter escreveu: > >> gordonb.rtzee@burditt.org (Gordon Burditt) writes: > >> > >> > >>> So, the user's browser (which need not have any DNS associated with > >>> its IP address) connects to site A with a request for a page. As > >>> part of that page, site A scrapes content from site B, a move which > >>> seems to have copyright infringement as its only logical goal (unless > >>> sites A and B have a common owner or an agreement to allow this), > >>> and sends the contents back to the user's browser. > >> > >> Granted in this case it probably is copyright infringement, but how does > >> that work for dynamic scraping? > >> > >> Is every web based proxy service performing copyright infringement to > >> serve the remote pages as-is? > >> > >> Are the Google Cache pages infringing on copyright? > >> > >> -- > >> Matthew Carter (m@ahungry.com) > >> http://ahungry.com > > > > Any idea so I can verify that the client domain is client.com? > > > > The real question here is - what are you trying to accomplish? > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > jstucklex@attglobal.net > ================== 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.
[toc] | [prev] | [next] | [standalone]
| From | Matthew Carter <m@ahungry.com> |
|---|---|
| Date | 2015-05-12 18:31 -0400 |
| Message-ID | <87r3ql2zsd.fsf@ahungry.com> |
| In reply to | #15319 |
alissonlinneker@gmail.com writes: > Em terça-feira, 12 de maio de 2015 18:09:25 UTC-3, Jerry Stuckle escreveu: >> On 5/12/2015 3:28 PM, alissonlinneker@gmail.com wrote: >> > Em terça-feira, 12 de maio de 2015 10:38:37 UTC-3, Matthew Carter escreveu: >> >> gordonb.rtzee@burditt.org (Gordon Burditt) writes: >> >> >> >> >> >>> So, the user's browser (which need not have any DNS associated with >> >>> its IP address) connects to site A with a request for a page. As >> >>> part of that page, site A scrapes content from site B, a move which >> >>> seems to have copyright infringement as its only logical goal (unless >> >>> sites A and B have a common owner or an agreement to allow this), >> >>> and sends the contents back to the user's browser. >> >> >> >> Granted in this case it probably is copyright infringement, but how does >> >> that work for dynamic scraping? >> >> >> >> Is every web based proxy service performing copyright infringement to >> >> serve the remote pages as-is? >> >> >> >> Are the Google Cache pages infringing on copyright? >> >> >> >> -- >> >> Matthew Carter (m@ahungry.com) >> >> http://ahungry.com >> > >> > Any idea so I can verify that the client domain is client.com? >> > >> >> The real question here is - what are you trying to accomplish? >> >> -- >> ================== >> Remove the "x" from my email address >> Jerry Stuckle >> jstucklex@attglobal.net >> ================== > > 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. Distribute API keys unique for each domain and track with that (block the API if the key isn't present in the request). -- Matthew Carter (m@ahungry.com) http://ahungry.com
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2015-05-12 21:52 -0400 |
| Message-ID | <miuamd$uv3$1@dont-email.me> |
| In reply to | #15319 |
On 5/12/2015 5:12 PM, alissonlinneker@gmail.com wrote: > Em terça-feira, 12 de maio de 2015 18:09:25 UTC-3, Jerry Stuckle escreveu: >> On 5/12/2015 3:28 PM, alissonlinneker@gmail.com wrote: >>> Em terça-feira, 12 de maio de 2015 10:38:37 UTC-3, Matthew Carter escreveu: >>>> gordonb.rtzee@burditt.org (Gordon Burditt) writes: >>>> >>>> >>>>> So, the user's browser (which need not have any DNS associated with >>>>> its IP address) connects to site A with a request for a page. As >>>>> part of that page, site A scrapes content from site B, a move which >>>>> seems to have copyright infringement as its only logical goal (unless >>>>> sites A and B have a common owner or an agreement to allow this), >>>>> and sends the contents back to the user's browser. >>>> >>>> Granted in this case it probably is copyright infringement, but how does >>>> that work for dynamic scraping? >>>> >>>> Is every web based proxy service performing copyright infringement to >>>> serve the remote pages as-is? >>>> >>>> Are the Google Cache pages infringing on copyright? >>>> >>>> -- >>>> Matthew Carter (m@ahungry.com) >>>> http://ahungry.com >>> >>> Any idea so I can verify that the client domain is client.com? >>> >> >> The real question here is - what are you trying to accomplish? >> > > 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. > You can't. All you can get is the requesting IP address. The requesting system will have some kind of identification - but it may or may not be your client's domain name. The server will have only one identifier but there may be many clients sharing that server. Matthew has one way to do it (unique id for each client). But you can't tell if your client didn't give a copy to another person. Or you could require your client to register the IP address it will be run from. Then every time their IP changes (i.e. if running on a local system with a dynamic IP address instead of a server), they'll have to re-register. Of course, either way will probably cost you clients. It's up to you whether it's worth it or not. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | gordonb.6xh3q@burditt.org (Gordon Burditt) |
|---|---|
| Date | 2015-05-13 18:25 -0500 |
| Message-ID | <sNmdnfP4pr_nQM7InZ2dnUU7-cWdnZ2d@posted.internetamerica> |
| In reply to | #15317 |
> Any idea so I can verify that the client domain is client.com? Yes. Give up on that one and try something that doesn't require cooperation from the person you're trying to catch. For example, insist that the clients use passwords or your service will be made to not work for the clients who don't supply them. There is not necessarily one IP per domain and even if there were it wouldn't help. The source IP of an outgoing connection from a PHP server need not have any relationship to the IP of the incoming HTTP connection. You'd have a better luck demanding that Yahoo's stock quotes give you the stock price for next year.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-05-13 20:37 +0200 |
| Message-ID | <1460004.zpnL6NzNTf@PointedEars.de> |
| In reply to | #15316 |
Matthew Carter wrote: > gordonb.rtzee@burditt.org (Gordon Burditt) writes: >> So, the user's browser (which need not have any DNS associated with >> its IP address) connects to site A with a request for a page. As >> part of that page, site A scrapes content from site B, a move which >> seems to have copyright infringement as its only logical goal (unless >> sites A and B have a common owner or an agreement to allow this), >> and sends the contents back to the user's browser. > > Granted in this case it probably is copyright infringement, but how does > that work for dynamic scraping? What do you mean? > Is every web based proxy service performing copyright infringement to > serve the remote pages as-is? No, but this question is well beyond the scope of this newsgroup. > Are the Google Cache pages infringing on copyright? Depends (cf. Field vs. Google, Inc.) But, first of all, “fair use” is a concept that does not exist in general outside of U.S. law, and “copyright” translates to various other rights in other countries. If you forbade Googlebot to index your site and they would still cache it, that would probably constitute an infringement of copyright on the part of Google, Inc. STFW (IANAL, and it took me only seconds to find that out). -- PointedEars Zend Certified PHP Engineer Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2015-05-12 12:09 +0000 |
| Message-ID | <misqh4$qc1$2@dont-email.me> |
| In reply to | #15310 |
On Mon, 11 May 2015 17:10:55 -0700, alissonlinneker wrote:
> 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?
I think you mean you want to know the host name of the client, but I'm
not sure.
Check the documentation for the $_SERVER array.
http://php.net/manual/en/reserved.variables.server.php
You seem to be using the array element for the client IP address in the
$_SERVER array and then complaining that it is giving you the ip address
instead of the host name.
If you want to get the remote host name instead of the remote IP address,
use the array element for the remote host name instead of the array
element for the remote IP address.
Pay attention to the additional notes in the referenced website - the
host name of the client may only be available if the web server has been
configured to provide it.
--
Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | alissonlinneker@gmail.com |
|---|---|
| Date | 2015-05-12 17:13 -0700 |
| Message-ID | <c86c5289-dcf3-4e0d-8dcf-6b0a072bf29e@googlegroups.com> |
| In reply to | #15310 |
Em segunda-feira, 11 de maio de 2015 21:11:00 UTC-3, alisson...@gmail.com escreveu:
> 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?
I'm doing this, but the curl and the filegetcontents does not return the client's domain.It is returning the reverse dns only.
Must return the domain. Any other tips?
[toc] | [prev] | [next] | [standalone]
| From | Erwin Moller <erwinmollerusenet@xs4all.nl> |
|---|---|
| Date | 2015-05-13 18:09 +0200 |
| Message-ID | <55537718$0$2877$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #15321 |
On 5/13/2015 2:13 AM, alissonlinneker@gmail.com wrote:
> Em segunda-feira, 11 de maio de 2015 21:11:00 UTC-3, alisson...@gmail.com escreveu:
>> 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?
>
> I'm doing this, but the curl and the filegetcontents does not return the client's domain.It is returning the reverse dns only.
>
> Must return the domain. Any other tips?
>
There simply isn't a domain associated with each IP.
So that approach won't work.
Another things you can do to allow limited access:
(Maybe the most user-friendly option)
Distribute keys (or username/password) and log on your server the remote
IP address using that key.
When you see more than, say, 5 different IP's connecting in last month,
contact the client, or block the account, or whatever you deem reasonable.
This is pretty very easy to set up. (One table in the database, storing
remote IP, and API-key, and month-year.)
Still, this might irritate some existing customers (extra overhead, and
this can cost you clients as Jerry mentioned earlier)
Your call.
In my opinion, if your service is worthwhile, most people won't mind
providing a key.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2015-05-18 09:56 +0200 |
| Message-ID | <55599B49.7050802@arnowelzel.de> |
| In reply to | #15310 |
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).
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2015-05-18 10:04 +0200 |
| Message-ID | <55599D06.7080208@arnowelzel.de> |
| In reply to | #15334 |
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. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-05-18 15:26 +0200 |
| Message-ID | <1865910.lMKXOGlSMj@PointedEars.de> |
| In reply to | #15335 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2015-05-18 15:53 +0200 |
| Message-ID | <5559EEEE.5080000@arnowelzel.de> |
| In reply to | #15336 |
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 <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. > 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
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web