Results 1 to 6 of 6

Thread: Help with QHttp needed.

  1. #1
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Help with QHttp needed.

    I’m trying to simply call a URL to handle a control of a cgi script on the web. The following function is what I’ve written, but it’s not making the call.


    Here is the url that I call from Internet Explorer to achieve what I’m trying to do:
    http://66.250.23.155:81/axis-cgi/com/ptz.cgi?zoom=8000


    void VideoLayout::zoom(unsigned level)
    {
    QString strLevel = "zoom=";
    strLevel += QString::number(level);
    QByteArray ba(strLevel.toStdString().c_str());

    QHttp camControl;
    camControl.setHost("66.250.23.155", 81);
    camControl.post("/axis-cgi/com/ptz.cgi", ba);
    }

    I sent this to Trolltech support and here was the response i got from them.

    You usually cannot just do this kind of thing with a single HTTP post. Depending on the server you will probably get an HTTP response back, pointing you to the actual URL that you should post to.
    I'm afraid there is no easy solution to this - you have to implement a complete HTTP response handler to actually do these kind of things.


    I'm not sure what a response handler is? I tried to catch some feedback by calling some of the following routines, which return "unknown error"

    QHttpResponseHeader response = camControl.lastResponse();
    int statCode = response.statusCode();
    QString err = response.reasonPhrase();

    Any examples or help would be wonderful. Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QHttp needed.

    It means that you have to handle the response for your request and send some other request depending on the response you got. Take a look at QHttp examples in Qt docs.

  3. #3
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help with QHttp needed.

    The documentation is not real clear on handling a response. I'm not sure i understand what that means. The QHttpResponseHeader just gives me "unknown error"

    When they handle the response are they talking about the QHttpResponseHeader or the IODevice pointer from the request routine. It seems to me that the IODevice pointer is used for a file request return.

    So what is meant by response handler and what is that i'm checking for a response?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QHttp needed.

    On the contrary, it is very clear about it.

    Read through this, there is everything you need: http://doc.trolltech.com/4.0/network-http.html

  5. The following user says thank you to wysota for this useful post:

    bitChanger (11th April 2006)

  6. #5
    Join Date
    Jan 2006
    Posts
    70
    Thanks
    13
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help with QHttp needed.

    The documentation that i refered to was the Qt Assistant. I had not seen the docs that you provided a link for. Thank you, they answered my question and it is now working for me.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QHttp needed.

    These are the same docs you have in Assistant. I couldn't post a link to your Qt Assistant, could I?

Similar Threads

  1. new QHttp() Error
    By fengtian.we in forum Qt Programming
    Replies: 7
    Last Post: 6th October 2010, 17:56
  2. problem in using QHttp
    By Ferdous in forum Newbie
    Replies: 4
    Last Post: 10th September 2008, 12:07
  3. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  4. QHttp download file problem.
    By fengtian.we in forum Qt Programming
    Replies: 12
    Last Post: 12th June 2007, 09:39
  5. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.