For error handling, I always add this at the start:
```c
curl_global_init(CURL_GLOBAL_ALL);
```
And at the end:
```c
curl_global_cleanup();
```
Prevents weird crashes from uninitialized stuff.
Also, `CURLOPT_ERRORBUFFER` lets you get detailed error messages:
```c
char errbuf[CURL_ERROR_SIZE];
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
```
```c
curl_global_init(CURL_GLOBAL_ALL);
```
And at the end:
```c
curl_global_cleanup();
```
Prevents weird crashes from uninitialized stuff.
Also, `CURLOPT_ERRORBUFFER` lets you get detailed error messages:
```c
char errbuf[CURL_ERROR_SIZE];
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
```
