Results 1 to 5 of 5

Thread: Qhttp

  1. #1
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Qhttp

    I modified slightly the example network/qhttp with the following url :
    Qt Code:
    1. QLineEdit("http://api.smsbox.fr/index.php?login=ahcoeur&pass=aaaaaa&action=credit");
    To copy to clipboard, switch view to plain text mode 

    which is a valid url that replies "CREDIT 362"

    however the server replies :
    "ERROR 01" missing parameters

    can you help ?

  2. #2
    Join Date
    Apr 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: Qhttp

    Hi,
    I never played with QUrl, but it looks like it does not accept url with GET items (like ?user=something&pass=xxx) in the constructor. Maybe you should just do a
    Qt Code:
    1. QUrl url;
    2. url->setEncodedQuery(urlLineEdit->text());
    To copy to clipboard, switch view to plain text mode 
    but I'm not sure that encodedQuery is the right function
    As a last resort, you would have to use the query items related functions of QUrl...

  3. The following user says thank you to madcat for this useful post:

    incapacitant (7th May 2006)

  4. #3
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Qhttp

    So I tried :

    Qt Code:
    1. qba.append("http://api.smsbox.fr/index.php?login=xx&pass=xx&action=credit");
    2. QUrl url;
    3. url.setEncodedUrl(qba);
    To copy to clipboard, switch view to plain text mode 

    Result is the same : missing parameters, it does not like this kind of url fr some reason.
    setEncodedQuery causes an unknown error from the QT4 sample and does not reply at all.

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Qhttp

    All you need to change is:
    Qt Code:
    1. httpGetId = http->get(url.path(), file);
    To copy to clipboard, switch view to plain text mode 
    to:
    Qt Code:
    1. httpGetId = http->get(url.toString(), file);
    To copy to clipboard, switch view to plain text mode 

    QUrl:ath() returns only the path part of the URL so you end up sending the GET request without appropriate query parameters.
    J-P Nurmi

  6. The following 2 users say thank you to jpn for this useful post:

    incapacitant (8th May 2006), patcito (31st May 2006)

  7. #5
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    106

    Default Re: Qhttp

    many many thanks

Similar Threads

  1. new QHttp() Error
    By fengtian.we in forum Qt Programming
    Replies: 7
    Last Post: 6th October 2010, 17:56
  2. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  3. QHttp with localhost.
    By William Wilson in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2007, 20:26
  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
  •  
Qt is a trademark of The Qt Company.