Hello All
This is my first post here and indeed this is a very informative forum. :-)
Can any body provide me an example of doing http put using QNetworkAccessManger class.
I tried a lot but was not successful.
Regards,
Printable View
Hello All
This is my first post here and indeed this is a very informative forum. :-)
Can any body provide me an example of doing http put using QNetworkAccessManger class.
I tried a lot but was not successful.
Regards,
Please post the errors you get and the code you tried.
hello tbscope
thanks for the reply.
I am not getting any errors but the at the same time my data is also not going to the server following is the code i tried:
Code:
QByteArray data; QUrl param; param.addEncodedQueryItem("user_credentials",singleaccesstoken.toAscii()); param.addEncodedQueryItem("login","username"); param.addEncodedQueryItem("password","pwd"); data.append(param.toString().toAscii()); data.remove(0,1); nam->put(request,data); where nam is QNetworkAccessManager.
I guess the way i am doing is wrong as this is my first time i am working with put with http.
Please let me know where i need to make changes.
Regards,
Your use of a QUrl and addEncodedQueryItem and converting the results to a string certainly seem weird to me.
And are you sure the server accepts a PUT request?
Can you debug the exact data you send to see if it is really what you want to send?
hello tbscope
Thats what i want to know, in what manner i should send data when using http put, can you make me clear with that first.
Secondly yes the server accepts data using http put. I just tried to do what i used during http post, so it will great if you can make me understand with the format i need to send the data to the server.
Regards,
Add these lines to your code, then look if it is exactly the same as you tried before (when it worked).
Code:
#include <QDebug> qDebug() << param.toString().toAscii();