I've confirmed just now that whatever requirement there was, it doesn't seem to be in effect.
Both omitting the header entirely, sending it with empty string, and sending with "-"; – all three result in a response from the MediaWiki API.
$ curl -A '' --include -v 'https://en.wikipedia.org/w/api.php?action=query&format=json' https://en.wikipedia.org/w/api.php?action=query&format=json'
GET /w/api.php?action=query&format=json HTTP/1.1 Host: en.wikipedia.org Accept: */*
< HTTP/1.1 200 OK .. {"batchcomplete":""}
$ curl -A '-' --include -v 'https://en.wikipedia.org/w/api.php?action=query&format=json' https://en.wikipedia.org/w/api.php?action=query&format=json'
GET /w/api.php?action=query&format=json HTTP/1.1 User-Agent: - Host: en.wikipedia.org http://en.wikipedia.org/ Accept: */*
< HTTP/1.1 200 OK .. {"batchcomplete":""}
In the past (2012?) these were definitely being blocked. (Ran into it from time to time on Toolserver) It seems php file_get_contents('http://...api..' http://...api..') is also working fine now, without having to init_set a user_agent value first.
-- Krinkle