Results 1 to 3 of 3

Thread: [QUrl] Auto-Login

  1. #1
    Join Date
    Oct 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [QUrl] Auto-Login

    Hi,

    I've a small problem.

    How did use this class for complete my login webpage ?

    A part of my code :

    QApplication app(argc, argv);

    QByteArray content("login=root&passwd=root");

    QHttpRequestHeader header("POST", "login.yahoo.com/config/login?");
    header.setValue("Host", "login.yahoo.com/config/login?");
    header.setContentType("application/x-www-form-urlencoded"); // important
    header.setContentLength(content.length());

    // request
    QFile file("result.html");

    QHttp http("login.yahoo.com/config/login?");
    http.request(header, content, &file);
    QUrl url2(http->text());



    app.connect(&http, SIGNAL(done(bool)), &app, SLOT(quit()));

    I'm test with this code, but this open a browser without complete value.


    QUrl url("https://login.yahoo.com/config/login?");

    url.setUserName("login=root&passwd=root");

    QDesktopServices:penUrl(url);


    Where the mistake please ?

    Thx

  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: [QUrl] Auto-Login

    I see at least two problems but I think the main problem is that you don't know which classes to use. If you want to make a http request (which I think you do) use QHttp or better yet QNetworkAccessManager. Another problem is the format of data you want to send, but I can't help you here. It's best to see how the original application (browser) does that and mimic it.

  3. #3
    Join Date
    Oct 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QUrl] Auto-Login

    Tanks for your help...

    If i want is much easy :

    view in my default browser (qdesktopservices) the webpage "login.yahoo.com/config/login?". After that, the form login and password complete by the request, and submit all for open my yahoo page.


    QNetworkAccessManager doesn't easy to implemente, have you any example in my problem ?

    Thx

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.