How can I POST data to a url using QNetworkAccessManager

后端 未结 6 1934
北荒
北荒 2020-11-30 22:33

I have a webservice that I need to POST some data to using Qt. I figured that I can use a QByteArray when POSTing to the web service.

My question is, how can I forma

6条回答
  •  悲&欢浪女
    2020-11-30 22:47

    the actually answer is

    QByteArray postData;
    postData.append("param1=string&");
    postData.append("param2=string");
    

    NOTE: use "&" here!!!.

    I didn't notice Juha's answer here, and waste much time on testing my code using the ",\n" approach.

    Please change the correct answer to Juha's.

提交回复
热议问题