How can I find out the address of an external request to the API of the application? I went through all the $_SERVER variables, but I can only get the address of the application itself. How can I find out the address of an external request that calls the API directly?
I don’t think there’s a way to do this. You could get the ip address calling the API, though.
An alternative would be to give each service who can call the API a code to use as a parameter so you can differentiate who is using the endpoint.
1 Like
Hi, Ben
That's exactly what I'm doing at the moment, but I need an address for statistical purposes.
Can you tell a little more about this? An ip address is quite suitable for me (I understand that there may be situations of different users who use the same ip address).
I’m not sure if I’m missing something, but you can use $_SERVER.REMOTE_ADDR
to get the IP address of the incoming HTTP request. Is that what you’re looking for?