PDA

View Full Version : Generint Post Method



Ricardo_arg
7th April 2011, 17:38
hi iam new to Qt i am tryng to generate Post method whithing a class.. but i cannot find a way to set the parameters for the POST method using QNetworkAccessManager, some guide will be appreciatting.

RzuF
7th April 2011, 18:41
connect(&nvm, SIGNAL(finished(QNetworkReply*)), this, SLOT(connector(QNetworkReply*)));

QNetworkRequest request(QUrl("string for your url"));
request.setHeader(QNetworkRequest::ContentTypeHead er,"application/x-www-form-urlencoded");

QByteArray data;

data.append("first_item=first_variable");
data.append("&second_item=second_variable")

nvm.post(request, data);

Remember you have to craete your own slot named connector (in my case you can name it as you want)