无法从C+;发送HTTP Post请求+; 我试图用C++向Citrix Server发送一个POST请求。 X-NITRO-USER、X-NITRO-PASS和Content-Type是我需要发送的请求头。 发送此请求的代码为: char *header1 ="X-NITRO-USER:aX-NITRO-PASS:aContent-Type:application/vnd.com.citrix.netscaler.lbvserver+json"; char *data1 = "{\"lbvserver\":{\"name\":\"myName\",\"servicetype\":\"myServiceType\"}}"; lCode = curl_easy_setopt(curlHandle, CURLOPT_HTTPHEADER, header1); lCode = curl_easy_setopt(curlHandle, CURLOPT_URL,aInClient.getUrl().getBuffer()); lCode = curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS,data1); lCode = curl_easy_perform(curlHandle);

无法从C+;发送HTTP Post请求+; 我试图用C++向Citrix Server发送一个POST请求。 X-NITRO-USER、X-NITRO-PASS和Content-Type是我需要发送的请求头。 发送此请求的代码为: char *header1 ="X-NITRO-USER:aX-NITRO-PASS:aContent-Type:application/vnd.com.citrix.netscaler.lbvserver+json"; char *data1 = "{\"lbvserver\":{\"name\":\"myName\",\"servicetype\":\"myServiceType\"}}"; lCode = curl_easy_setopt(curlHandle, CURLOPT_HTTPHEADER, header1); lCode = curl_easy_setopt(curlHandle, CURLOPT_URL,aInClient.getUrl().getBuffer()); lCode = curl_easy_setopt(curlHandle, CURLOPT_POSTFIELDS,data1); lCode = curl_easy_perform(curlHandle);,c++,curl,citrix,C++,Curl,Citrix,我得到以下错误: {“errorcode”:-1,“message”:“未指定密码”,“severity”:“ERROR”}虚拟机的输出REST API=HTTP/1.0 任何帮助都将不胜感激。提前感谢。标题数据中似乎缺少一些换行符。还要记住,HTTP头之间的换行必须是回车/换行序列“\r\n”。添加“\r\n”后,将显示以下错误:char*header1=“X-NITRO-USER:a\r\nX NITRO-PASS:a\r\n内容类型:application/vnd.com.citrix.n

我得到以下错误:

{“errorcode”:-1,“message”:“未指定密码”,“severity”:“ERROR”}虚拟机的输出REST API=HTTP/1.0


任何帮助都将不胜感激。提前感谢。

标题数据中似乎缺少一些换行符。还要记住,HTTP头之间的换行必须是回车/换行序列
“\r\n”
。添加“\r\n”后,将显示以下错误:char*header1=“X-NITRO-USER:a\r\nX NITRO-PASS:a\r\n内容类型:application/vnd.com.citrix.netscaler.lbvserver+json”;{“errorcode”:-1,“message”:“无效格式:内容类型中可能的编码值只能是xml或json”,“severity”:“ERROR”}请再次阅读错误消息,我觉得非常清楚。