#include <QtCore>
#include <QtDebug>
#include <QtNetwork>
#include <iostream>
int main(int argc, char* argv[])
{
// content
// header
header.setValue("Host", "www.membres.lycos.fr");
header.setContentType("application/x-www-form-urlencoded"); // important
header.setContentLength(content.length());
// request
QFile file("result.html");
QHttp http
("www.membres.lycos.fr",
80);
http.setProxy("172.16.1.1", 8080);
http.request(header, content, &file);
a.connect(&http, SIGNAL(done(bool)), &a, SLOT(quit()));
return a.exec();
}
#include <QtCore>
#include <QtDebug>
#include <QtNetwork>
#include <iostream>
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);
// content
QByteArray content("a=root&b=root&c=submit");
// header
QHttpRequestHeader header("POST", "/nyphel/Essais_stage/essai.php");
header.setValue("Host", "www.membres.lycos.fr");
header.setContentType("application/x-www-form-urlencoded"); // important
header.setContentLength(content.length());
// request
QFile file("result.html");
QHttp http("www.membres.lycos.fr", 80);
http.setProxy("172.16.1.1", 8080);
http.request(header, content, &file);
a.connect(&http, SIGNAL(done(bool)), &a, SLOT(quit()));
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks