Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,369 members, 7,808,287 topics. Date: Thursday, 25 April 2024 at 09:54 AM

This Php Server Remote Addr Is Giving Me Different Device Ip Address - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / This Php Server Remote Addr Is Giving Me Different Device Ip Address (1013 Views)

Help With This Php Problem / Please Help Me In This PHP Pagination Code / If You Can Modify This Php Source Code Drop Your Contact (2) (3) (4)

(1) (Reply) (Go Down)

This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:59pm On Aug 23, 2021
Any solution for my pitfall

I tried getting my ip address using server global function remote addr but this is wat i getting.

Different ip that is not the same with my phone ip.

Photo below


This is my website to see the error

Advisedlyremove

Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 11:16pm On Aug 23, 2021
Are you using wifi to connect to the website?
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 11:17pm On Aug 23, 2021
webapi:
Are you using wifi to connect to the website?
noooo my data
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by Codedboy95(m): 1:06am On Aug 24, 2021
dodgelord:
Any solution for my pitfall

I tried getting my ip address using server global function remote addr but this is wat i getting.

Different ip that is not the same with my phone ip.

Photo below


This is my website to see the error

Advisedlyremove

What remote addr shows is your public addresss which is provided by your Mobile operators/ISPs. There is no way to get your phone private ip address in php, head over to whatismyipaddress. com you will see that it grabs same IP address as your php code.
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 2:19am On Aug 24, 2021
Codedboy95:


What remote addr shows is your public addresss which is provided by your Mobile operators/ISPs. There is no way to get your phone private ip address in php, head over to whatismyipaddress. com you will see that it grabs same IP address as your php code.


i try to using my mom phone to access my site to see if i will get a diff ip,,,,, but they re the same.
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 9:44am On Aug 24, 2021
dodgelord:



i try to using my mom phone to access my site to see if i will get a diff ip,,,,, but they re the same.

Which network are you using?

1 Like

Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:34am On Aug 24, 2021
webapi:


Which network are you using?
glo
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 10:39am On Aug 24, 2021
dodgelord:
glo
Visit this website to see your ip address and compare with what you are getting in php https://whatismyipaddress.com/

1 Like 1 Share

Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:40am On Aug 24, 2021
webapi:

Visit this website to see your ip address and compare with what you are getting in php https://whatismyipaddress.com/
see wat am getting

Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:42am On Aug 24, 2021
webapi:

Visit this website to see your ip address and compare with what you are getting in php https://whatismyipaddress.com/

Here's wat am trying to pass to u.

I used 3 phones to access my site to see if it will give a different IP.

But, still getting the ip number no changes
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 11:48am On Aug 24, 2021
dodgelord:


Here's wat am trying to pass to u.

I used 3 phones to access my site to see if it will give a different IP.

But, still getting the ip number no changes
Ofcourse it will give you same ip because the ip address php is getting is from your ISP and the location. Php cannot have access to your device details. Only if you are building a mobile app you can have such access. That is why websites uses ip address to block visitors based on location. You cannot block a visitor based on his/her device. So yes your php code is doing the right thing. Hope this helps
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 11:57am On Aug 24, 2021
webapi:

Ofcourse it will give you same ip because the ip address php is getting is from your ISP and the location. Php cannot have access to your device details. Only if you are building a mobile app you can have such access. That is why websites uses ip address to block visitors based on location. You cannot block a visitor based on his/her device. So yes your php code is doing the right thing. Hope this helps

Nice.....

Which one is nairaland using to get guest online?
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 1:42pm On Aug 24, 2021
dodgelord:


Nice.....

Which one is nairaland using to get guest online?
Well i can't tell what nairaland is using but i get mine using socket io. If you are familiar with that, you should be able to get realtime visitors count. Also do not store these info in your database. You don't want to overload your database with a temporary counter. Hope this helps
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:18pm On Aug 24, 2021
webapi:

Well i can't tell what nairaland is using but i get mine using socket io. If you are familiar with that, you should be able to get realtime visitors count. Also do not store these info in your database. You don't want to overload your database with a temporary counter. Hope this helps
where should i store it
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 12:26am On Aug 25, 2021
dodgelord:
where should i store it
Don't store it anywhere if what you are looking for is visitors counts. Just display the counter on your frontend. Hope this helps
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by dodgelord: 10:16am On Aug 25, 2021
webapi:

Don't store it anywhere if what you are looking for is visitors counts. Just display the counter on your frontend. Hope this helps


when the visitor leaves the site it will delete from the db
Re: This Php Server Remote Addr Is Giving Me Different Device Ip Address by webapi: 10:22am On Aug 25, 2021
dodgelord:



when the visitor leaves the site it will delete from the db
If you can do it that way that's fine

1 Like

(1) (Reply)

How Relevant Is C++ In Programming / I've Got A Java Bug. I Need Help! / Where Are All The Qualified Programmers?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.