Fixes Undefined index: searchResult when the response content is empty or not valid json
Fixes Undefined index: QUERY_STRING when running script on cli
Merge pull request #16 from nicovogelaar/pull-request-3

Added some checks to prevent Undefined index notices