[curl] curl_slist_append

curl_slist_append



CURL *curl;

char host_header[256];

char vhost[256];

struct curl_slist *slist;



slist=0;

memset(host_header, 0, 256);

memset(vhost, 0, 256);



strncpy(vhost, "127.0.0.1", 9);

strncpy(host_header, "Host: ", 6);

strncat(host_header, vhost, 256-1-strlen(host_header));



slist = curl_slist_append(slist, host_header);

curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);

 

你可能感兴趣的:(append)