Passes $api_key via constructor. Uses http_build_query. 

Uses the standard PHP function `http_build_query` for the query building rather than the foreach loop.

The API key is passed via the constructor, rather than using a global.