This post has been edited 1 times, last edit by "mikhailt" (Sep 12th 2006, 11:05pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// Requestheader goes in here
QByteArray *buf = new QByteArray("GET / HTTP/1.1\r\nHost: host.com\r\nConnection: close\r\n\r\n");
// Connection to host
QTcpSocket *sock = new QTcpSocket();
sock->connectToHost("host.com",80,QIODevice::ReadWrite);
sock->write(buf->data(),buf->length());
// implement check for data available to be recieved.
x
x
x
// clear the buffer and read all available data from socket.
buf->clear();
buf->append(sock->readAll());
sock->disconnectFromHost();
// response goes into buf.
|
This post has been edited 2 times, last edit by "moogle" (Sep 13th 2006, 10:57pm)
|
|
Source code |
1 2 3 4 5 6 7 8 |
QHttp *http = new QHttp();
QFile file("recv.txt");
if (file.open(QIODevice::WriteOnly)) {
http->setHost("www.host.com",80);
http->get("/path/to/url.php?id=100&s=10",&file);
file.close();
http->closeConnection();
}
|
This post has been edited 2 times, last edit by "moogle" (Sep 15th 2006, 1:03pm)
Quoted
Okay, so the only thing you want to do is send a GET-parameter?
Why can´t you do it with QHttp?
