Fixed Undefined Variable Error

Because `$API_KEY` wasn't declared global within the function, it couldn't be accessed.
Merge pull request #2 from citruspi/patch-1

Fixed Undefined Variable Error