donatj/PhpUserAgent

Support reading system details even the user agent is not fully written

samaphp opened this issue · 5 comments

Thank you for this amazing function <3

Current version does not support reading details in User-Agent if it is not full detailed.
Example:
User-Agent: AppName/1.0.23 (example.com/AppName; example@example.com).

It just read the AppName with version and does not read the system details.

This case usually used when contacting APIs where everyone should write self-described User-Agent.

Many Thanks

I wrote extra code to support this kind of user-agents on this pull request #44

The example you give doesn't appear to contain any system information? Please correct me if I'm misunderstanding.

If system info isn't provided I cannot provide details that are not in the user agent string itself. However if system information is provided ala

AppName/1.0.23 (example.com/AppName; example@example.com; Windows)

It does return AppName version 1.0.23 on Windows as one would expect.

Thank you for this fast response. Depending on Wikipedia this part of User-Agent:

(iPad; U; CPU OS 3_2_1 like Mac OS X; en-us): Details of the system in which the browser is running.
Refer to system and application details.

Also, it's most common when calling APIs that you should set a user-agent for all your requests like this New-Relic example.

and a lot of other API documentations.

So, now when I'm building an API I should take care of this kind of user-agents and read them correctly.

Thanks

I made my comment before you submitted your PR. I can absolutely see a desire to get those parts of the UA string. I will need to take some time and experiment with how this applies to things across the board, but I really like the idea of your PR #44

Yes sure, take your time. I already have my own fork with this update.
If you have any notes I will be glad to resubmit my PR and fixing test assertion issue.
Thanks for your time. And thanks again for this amazing function. 🌹