How to use php to obtain the ip address of the client server _ PHP Tutorial

Source: Internet
Author: User
Use php to obtain the ip address of the client server .? Phpecho current script SERVER host name:. gethostbyaddr ($ _ SERVER [REMOTE_ADDR]). brhr; echo get the IP address of the SERVER where the PHP script (page) is currently running:. $ _ SERVER
Echo "host name of the current script SERVER:". gethostbyaddr ($ _ SERVER ['remote _ ADDR '])."
"; Echo" obtain the IP address of the SERVER on which the PHP script (page) is currently running: ". $ _ SERVER ['server _ ADDR ']."
"; Echo" get the host name of the server on which the PHP script (page) is currently running :". $ _ SERVER ['server _ name']; echo ''; echo 'Client ip '. $ _ SERVER ['remote _ ADDR ']; echo'
'; Echo 'Client ip'. getenv ('remote _ ADDR'); echo"
"; Echo 'server host ip'. gethostbyname (" www.qq.com ");?>

Run:
Host name of the current script server: XYL-PC
Obtain the IP address of the server on which the PHP script (page) is currently running: 127.0.0.1
Obtain the host name of the server where the PHP script (page) is currently running: localhost
Client ip127.0.0.1
Client ip127.0.0.1
Server host ip61.135.169.105

Http://www.bkjia.com/PHPjc/372090.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/372090.htmlTechArticle? Php echo host name of the current script server :. gethostbyaddr ($ _ SERVER ['remote _ ADDR ']). br/hr/; echo: obtain the IP address of the server on which the PHP script (page) is currently running :. $ _ SERVER...

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.