[PHP] Read the IP address of the connection

Created on November 30, 2026

In an HTTP request, $_SERVER['REMOTE_ADDR'] contains the IP address of the peer that connected to the server.

<?php

echo $_SERVER['REMOTE_ADDR'];

If your application sits behind a proxy, this may be the proxy's address.

PHP