Hi everyone,
I want to send some data using http request through proxy,
in c++ i usually send it using qnetworkproxy as following;
i want the same thing with qml but till now i didnt find anything helpfull to accomplish thatQNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName("thehostname...");
proxy.setPort(80);
QString dataa;
dataa = "myDataToSend";
nam = new QNetworkAccessManager(this);
QByteArray myData(dataa.toAscii());
connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(finishsending(QNetworkReply*)));
nam->setProxy(proxy);
nam->post(QNetworkRequest(QUrl("http://.....")),myData);
i am sending http request as following , but i need to know how to set the proxy for sending the data!!!
How can i solve my problemvar req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (req.readyState == XMLHttpRequest.DONE) { // 4 instead of 'XMLHttpRequest.DONE' works here too
console.log("Request complete");
if (req.status == 200) {
if(req.responseText != "0")
{
console.log("Status code: 200");
console.log(req.responseText + "...")
//some functions to do here
}
}
else
{
console.log("Status code error: "+req.status+" Unable to connect to internet..");
}
}
}
req.open("POST","http://......",true);
req.send("myDataToSend");
Thank you
Rondo

Reply With Quote


