Adding HTTP error code checking to CURL call

Now verifies the return value was a successful response before returning