Avoid API errors with empty results and nolog

If a query is made via the API for a subject with no results and nolog
is passed there will be no data returned. This was causing a 'Can't use
an undefined value as an ARRAY reference' error and apache would return
500.

This change adds a check to ensure data was returned before attempting
to treat it as an array.

Tested: API and command line calls for known subjects ('google.com') and
unknown subjects ('aoeu1234') with nolog on and nolog off. Confirmed no
exceptions.
Merge pull request #68 from rtkpmcalpine/nolog_exception

Avoid API errors with empty results and nolog
changelog
Fix error for hostname starting with IPv4 address

Hostname queries for non-IPv4 subjects which match an IP address were
causing 500 errors from the CIF API. This change updates the regex test
to be more specific in determining if the query should be treated as an
IPv4 address or a hostname.

Example hostname which would cause an error: 1.2.3.4.mydomain.com

Tested: Perform queries of:
- hostname prefaced with an IPv4 address
- CIDR address
- IPv4 address
Confirmed CIDR and IPv4 addresses were matched by updated regex.