Plain whois. Any language.
Prefix WhoIs speaks whois on TCP port 43, so every language already has a client. These libraries add bulk mode, the extra query types, and — in C — recursive digging across the other registries.
C whois library
Full support for pWhoIs in bulk or single queries. Also speaks to ARIN, RIPE, APNIC, RADB, Cymru and RIPE RIS, with functions that recurse until they find the information you are after. The current whois.c and whois.h ship inside LFT, which is built on them.
PHP client for pWhoIs
One file, no dependencies: single lookups and bulk batches, IPv4 and IPv6, de-duplication, an optional 24-hour cache and a quota check. The page runs live queries so you can see the shape of every answer.
PHP client for RIPE NCC RIS
The origin AS and prefix for one address or thousands in bulk, every route covering an address, and every prefix an AS announces, from RIPE NCC's Routing Information Service. Same shape and same optional cache as the pWhoIs client.
Or skip the library
Ask the server for type=json and there is nothing to parse. Send begin, one address per line, end, and you have bulk mode from a shell. Field order is not guaranteed — match on keys, not line offsets, and your parser will be fine forever.