I assume that they need them to be handed over through a legal process in order to be admissible in court.
It is generally not allowed to use illegally obtained evidence in court.
Yes, I know that it does happen, and people who can not afford effective legal representation get convinced
Not sure exactly what you want, but like this may be what you want. https://github.com/PeterDaveHello/ipinfo.tw
There are simpler solutions that are just a php script on your web server if you're only interested in IP address (I couldn't find a good example quickly on mobile)