api.php: Use $wgRequest to retrieve User-agent string

api.php was directly accessing $_SERVER superglobal.
It should use WebRequest wrapper object instead.

Change-Id: I244fb7a35476e9a35a5dc97f898d39c82c54b7fa
Merge "api.php: Use $wgRequest to retrieve User-agent string"