IP server address

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
kepler
New php-forum User
New php-forum User
Posts: 7
Joined: Sun Jul 16, 2017 9:38 pm

Sun Jul 15, 2018 4:33 pm

Hi,

I have a WordPress plugin, which contacts my server. I wish to save its ip adress. Is it

Code: Select all

$_SERVER['REMOTE_ADDR']
the best way to get it? I don't wish the user IP while using my plugin - but the server domain using it. I tryed to compare the domain ip (saved on my database) against the referrer, but sometimes they are different.

Any ideas?

Kind regards,

Kepler

User avatar
benanamen
New php-forum User
New php-forum User
Posts: 55
Joined: Mon Oct 16, 2017 1:06 pm

Mon Jul 16, 2018 8:58 am

What is the real problem you are trying to solve? I dont mean your attempt at solving it.

If you are trying to do some sort of traffic tracking you are better off using Google Analytics.
The XY Problem
The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

Gerren
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Jul 12, 2018 2:29 am

Thu Jul 19, 2018 5:05 am

Why would Google Analytics be superior for that kind of stuff btw?

kepler
New php-forum User
New php-forum User
Posts: 7
Joined: Sun Jul 16, 2017 9:38 pm

Thu Jul 19, 2018 5:51 am

Hi

Thanks for the replies. The idea is to have the most accurate and possible IP information of the IP server which is making the request to my own server for authenticate the license. This info can, of course, be faked via browser. But the communication will be with an api key between the client server and mine.

The problem, is that the ip making the request sometimes is not equal to the registered domain. More times than it should.

So maybe I should try to find the several ips (or range) of the server where the domain is...? It's a little bit tricky.

Kind regards,

Kepler

Phi11W
New php-forum User
New php-forum User
Posts: 17
Joined: Thu Aug 17, 2017 3:37 am

Thu Jul 19, 2018 6:39 am

kepler wrote:
Thu Jul 19, 2018 5:51 am
The problem, is that the ip making the request sometimes is not equal to the registered domain. More times than it should.
Welcome to the Weird and Wacky World of the World Wide Web.

It's just full of servers, routers, proxies, reverse proxies, firewalls and delights like DHCP, all of which can mask / change / distort the I.P.Address that your application receives from any given client.

When a client replaces their computer, they can wind up with a different I.P. Address, rendering them strangers to your application and invalidating their licence.

Time to look for an alternative, I think.

Regards,
Philll W.
Regards,
Phill W.

Post Reply