How to obtain the IP address of the request server

Source: Internet
Author: User
How can I obtain the IP address of the request server. php, and then use B. input parameters to. php, how to make. php knows the IP address of B. thank you for obtaining the IP address of the requesting server.
I have A. php on server a, and then use B. php on server B to pass the parameter to a. php. how can I let a. php know the IP address of B? thank you for sharing:
------ Solution --------------------
$ _ SERVER ['remote _ ADDR '] obtains the IP address of the requester.
------ Solution --------------------
Gethostbyname: get the IP address of the specified Internet host name.
Example:
Echo gethostbyname ('bbs .csdn.net '); // 117.79.157.198

------ Solution --------------------
Reference:
I have A. php on server a, and then use B. php on server B to pass the parameter to a. php. how can I let a. php know the IP address of B? thank you.

$ _ SERVER [SERVER_ADDR]
------ Solution --------------------
Generally, the REMOTE_ADDR, HTTP_X_FORWARDED_FOR, HTTP_CLIENT_IP, and HTTP_X_FORWARDED_FOR parameters of the $ _ SERVER variable are used.

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.