Trouble using ipify API

I am using Ipify API to see IP adresses in my project. However, when I run this code:

    $ip = file_get_contents('');
    echo "My public IP address is: " . $ip;

I get the project container’s IP. What am I doing wrong?

Nothing wrong, because the code is running on the container so it would show the container ip

If you want the IP address that the request came from, take a look at the first part of the x-forwarded-for header whenever a request is made.