OP, from what I understand, you want to know the given location of the user without the consent of access to the location services of the user.
A way to do this, rather than a super reliable one, I would add, is to reverse-geolocate their IP address using the server-side geocoding API.
Remember that it is not super reliable, but it can do the trick. You may encounter problems on mobile phones, especially due to the erratic nature of their IP addresses.
Twitter itself has an API to help with this. For example, you can use the GET geo-search to find the identifier of the place closest to a given IP address using this:
https://dev.twitter.com/rest/reference/get/geo/search
and then you can use this place id to find out the approximate Lat / Long of the user using GET geo / id /: place_id:
https://dev.twitter.com/rest/reference/get/geo/id/%3Aplace_id
(there are probably more direct ways to do this in other APIs as well, but I assume that you have already authenticated with the twitter API, so I'm trying to give you something easier to integrate into your code)
Let me know if this helps.
Usernumbernine
source share