Weedpacket;10991476 wrote:myfile.php might also be able to use one of the $_SERVER variables to get the IP address from which the request for it is coming.
I thought the OP was asking about the local domain that's including the remote content, e.g. the domain on which the above PHP code is being executed (not my-external-domain.com, in other words).
If not, then I agree - $_SERVER might already provide the needed info.