Php ip address retrieval problems

Source: Internet
Author: User
The php ip address retrieval problem seems to be different from the actual IP address obtained by $ _ SERVER. I don't know what the problem is. how can I get the IP address? Now this data is very important to this project, so it is more accurate to use JavaScript? There is a data: 211.139.151.74 & nbsp; IP address you query: 211.139.151.74 & nbsp; master data of this site: Guangdong Mobile php ip address acquisition problem
The IP address obtained with $ _ SERVER seems to be different from the actual IP address. I don't know what's going on.
How do you obtain the IP address?
This data is very important to this project, so the requirements are more accurate.
Will JavaScript be more accurate?

The data is 211.139.151.74.

IP address: 211.139.151.74
Main data of this site: Guangdong Mobile (sharing across the province)
Result 2: Guangdong Mobile (sharing across the province)
Query Result 3: Guangdong Mobile GPRS (General in the province)
What does that mean?

------ Solution --------------------
· Under normal circumstances, js does not have the permission to obtain information such as ip addresses.
· If you need to be more accurate, consider using plug-ins.
------ Solution --------------------
Unset ($ onlineip );

If ($ _ SERVER ['http _ CLIENT_IP ']) {
$ Onlineip = $ _ SERVER ['http _ CLIENT_IP '];
} Elseif ($ _ SERVER ['http _ X_FORWARDED_FOR ']) {
$ Onlineip = $ _ SERVER ['http _ X_FORWARDED_FOR '];
} Else {
$ Onlineip = $ _ SERVER ['remote _ ADDR '];
}
------ Solution --------------------
The IP address obtained with $ _ SERVER seems to be different from the actual IP address. I don't know what's going on ??
Is it intranet? Otherwise, there should be no discrepancies.

IP address: 211.139.151.74
Main data of this site: Guangdong Mobile (sharing across the province)
Result 2: Guangdong Mobile (sharing across the province)
Query Result 3: Guangdong Mobile GPRS (General in the province)
What does that mean?

Are you going to someone else's website to check IP information?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.