[Qt-interest] HTTP CGI Problems

Thiago Macieira thiago at kde.org
Wed Sep 16 20:37:20 CEST 2009


Em Quarta-feira 16. Setembro 2009, às 17.37.01, Bryce Salmi escreveu:
> Qt-Interest,
> 
>      I am trying to program HTTP protocol into my Qt program.  When the
> user clicks a button I invoke Qt's HTTP commands to send a GET to an IP
> address and start a CGI script. Before posting here I searched through
> the archives but couldn't find anything that really answered my
> question. An example of my implementation of the HTTP protocol with Qt:
> 
> 
> 
> QHttp http("192.168.1.20");

Don't use QHttp, please. Use QNetworkAccessManager:

> 
> QFile file ("file");
> 
> http.setHost("192.168.1.20");
> 
> http.get("/something.cgi", &file);
> 
> http.close();

QNetworkReply *reply = manager.get("http://192.168.1.20/something.cgi");
connect(reply, SIGNAL(finished()), obj, SLOT(handleFinished()));

When handleFinished() is called, read the data with reply->read() and reply-
>readAll().

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090916/e9a85cf6/attachment.bin 


More information about the Qt-interest-old mailing list