Question

I have created web services using PHP for mobile applications (Android, iPhone or other).

Now I want to identify the platform of user who is calling my api service using PHP, so how can I do that?

In other words, the api call is being made from two different devices, I want that device's platform name.

Please help.

There is a good php function to parse the user agent, but it does not work when the request is from an Android app or iPhone app. Here is the link: https://github.com/donatj/PhpUserAgent

Was it helpful?

Solution

I actually wrote said function you linked and the commenter is correct in that if your request is not explicitly sending a user agent header there is nothing for the script to parse and no way to know the platform making the request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top