I know it's tedious, but you need to check each of these `curl_easy_setopt` calls for errors.

Consider breaking some of this code into a separate function called `create_curl_handle` or something.