Results 1 to 14 of 14

Thread: amazonFrLogin

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

    Talking amazonFrLogin

    I call the amazon.fr url as follows :

    Qt Code:
    1. //*****************************************************************************
    2. void ApplicationWindow::amazonFrLogin()
    3. //*****************************************************************************
    4. {
    5. QMessageBox::critical( this, "Mutant", "enter amazonFrLogin" );
    6. // target url
    7. QUrl url("[URL="http://www.amazon.fr"]http://www.amazon.fr[/URL]");
    8.  
    9. http = new QHttp(this);
    10. connect(http, SIGNAL(done(bool)), this, SLOT(getLogin(bool)));
    11. // remember to set the host
    12. http->setHost(url.host());
    13.  
    14. // the resulting data will be stored in the buffer
    15. buffer = new QBuffer(this);
    16. http->get(url.toString(), buffer);
    17. }
    18. //*****************************************************************************
    19. void ApplicationWindow::getLogin( bool error )
    20. //*****************************************************************************
    21. {
    22. QMessageBox::critical( this, "Mutant", "enter getLogin" );
    To copy to clipboard, switch view to plain text mode 

    I get when I execute :
    "Mutant", "enter amazonFrLogin"

    But never "Mutant", "enter getLogin" as if the call failed somewhere.
    So the application goes back to the main loop and waits.

    I have use this piece of code before so I know it works.
    What can be wrong ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: amazonFrLogin

    Quote Originally Posted by incapacitant
    QUrl url("<a class="bbcodeurl" href="http://www.amazon.fr" target="_blank">http://www.amazon.fr</a>");
    This should be:
    Qt Code:
    1. QUrl url( "http://www.amazon.fr" );
    To copy to clipboard, switch view to plain text mode 
    And make sure you add some delay between requests, not to irritate the admins.

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

    incapacitant (24th July 2006)

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

    Talking Re: amazonFrLogin

    that is what the code, it has been garbled when i posted should be :
    Qt Code:
    1. //*****************************************************************************
    2. void ApplicationWindow::amazonFrLogin()
    3. //*****************************************************************************
    4. {
    5. QMessageBox::critical( this, "Mutant", "enter amazonFrLogin" );
    6. // target url
    7. QUrl url("[URL="http://www.amazon.fr"]http://www.amazon.fr[/URL]");
    To copy to clipboard, switch view to plain text mode 

    Again there is no formatting like this my source code.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: amazonFrLogin

    Quote Originally Posted by incapacitant
    But never "Mutant", "enter getLogin" as if the call failed somewhere.
    So the application goes back to the main loop and waits.

    I have use this piece of code before so I know it works.
    What can be wrong ?
    Are you sure that getLogin() is a slot?

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

    Talking Re: amazonFrLogin

    Quote Originally Posted by jacek
    This should be:
    Qt Code:
    1. QUrl url( "http://www.amazon.fr" );
    To copy to clipboard, switch view to plain text mode 
    And make sure you add some delay between requests, not to irritate the admins.
    My code says that, it garbled when I paste the text;
    When I paste in notepad, no problem

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

    Talking Re: amazonFrLogin

    Anyway it does not work with the old url either.
    I have to investigate before you try to find for nothing.
    There is a bug elsewhere I have to find.

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

    Smile amazonFrLogin

    I have a problem. The following code does not work properly.
    I tried to make it short.

    Qt Code:
    1. //*****************************************************************************
    2. void ApplicationWindow::creditUrl()
    3. //*****************************************************************************
    4. {
    5. // target url
    6. QUrl url("http://api.smsbox.fr/index.php?");
    7. url.addQueryItem("login", iniGet( "Login" ));
    8. url.addQueryItem("pass", iniGet( "Password" ));
    9. url.addQueryItem("action", iniGet( "Action" ));
    10.  
    11. http = new QHttp(this);
    12. connect(http, SIGNAL(done(bool)), this, SLOT(defineSMSCredit(bool)));
    13. // remember to set the host
    14. http->setHost(url.host());
    15.  
    16. // the resulting data will be stored in the buffer
    17. buffer = new QBuffer(this);
    18. http->get(url.toString(), buffer);
    19. }
    20.  
    21. //*****************************************************************************
    22. void ApplicationWindow::defineSMSCredit( bool error )
    23. //*****************************************************************************
    24. {
    25. // handle http reply for credit request
    26. handleSMSCredit( error );
    27.  
    28. // read destin undefined from ini file
    29. qS = iniGet( "TxtDestinataires" ) + " " + iniGet( "TxtIndefini" );
    30. appendRow( qS );
    31. // connect
    32. connect( pbDestin, SIGNAL( clicked() ), this, SLOT( destinataires() ) );
    33. connect( pbArchiv, SIGNAL( clicked() ), this, SLOT( archives() ) );
    34. connect( pbConfig, SIGNAL( clicked() ), this, SLOT( config() ) );
    35. connect( pbApropos, SIGNAL( clicked() ), this, SLOT( apropos() ) );
    36. connect( pbEnvoyer, SIGNAL( clicked() ), this, SLOT( envoyer() ) );
    37. connect( qMessage, SIGNAL( textChanged() ), this, SLOT( messageChanged() ) );
    38. connect( pbClose, SIGNAL( clicked() ), this, SLOT( hide() ) );
    39. return;
    40. }
    41. //*****************************************************************************
    42. void ApplicationWindow::destinataires()
    43. //*****************************************************************************
    44. {
    45. QMessageBox::warning( this, "Mutant", "enter destinataires" );
    46. // target url
    47. QUrl url("http://api.smsbox.fr/index.php?");
    48. url.addQueryItem("login", iniGet( "Login" ));
    49. url.addQueryItem("pass", iniGet( "Password" ));
    50. url.addQueryItem("action", iniGet( "Action" ));
    51.  
    52. http = new QHttp(this);
    53. connect(http, SIGNAL(done(bool)), this, SLOT(amazon_MainPage(bool)));
    54. // remember to set the host
    55. http->setHost(url.host());
    56.  
    57. // the resulting data will be stored in the buffer
    58. buffer = new QBuffer(this);
    59. http->get(url.toString(), buffer);
    To copy to clipboard, switch view to plain text mode 

    The first http call is processed properly when creditUrl() is called.

    For the second call I enter destinataires as I get the message box.
    Then nothing, goes back to main loop never goes to amazon_MainPage.
    Last edited by jacek; 24th July 2006 at 13:34. Reason: fixed URLs

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

    Wink amazonFrLogin

    the html coding in the urls is added by the post. i don't have it in my code pasting from
    notepad !

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: amazonFrLogin

    Quote Originally Posted by incapacitant
    the html coding in the urls is added by the post. i don't have it in my code pasting from
    notepad !
    Just uncheck the "Automatically parse links in text" checkbox below the editor.

  11. The following user says thank you to jacek for this useful post:

    incapacitant (24th July 2006)

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

    Smile amazonFrLogin

    When I query www.amazon.fr here is what I get back :

    [HTML]
    Version 1.0 StartHTML:0000000105 EndHTML:0000002015 StartFragment:0000000127 EndFragment:0000001997
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>302 Found</title>
    </head><body>
    <h1>Found</h1>
    <p>The document has moved <a href="http://www.amazon.fr/exec/obidos/tg/browse/-/405320">here</a>.</p>
    </body></html>

    [/HTML]

    rather than the site.

    What am I doing wrong ?

  13. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: amazonFrLogin

    Quote Originally Posted by incapacitant
    What am I doing wrong ?
    Nothing --- just open www.amazon.fr with a normal browser and you will be redirected too.

  14. The following user says thank you to jacek for this useful post:

    incapacitant (24th July 2006)

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

    Smile Re: amazonFrLogin

    Qt Code:
    1. QUrl url("[URL="http://www.amazon.fr"]http://www.amazon.fr[/URL]");
    To copy to clipboard, switch view to plain text mode 

    the says "http::etc..." without coding, I can't help but show it on the post.
    parse links on or off

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

    Default amazonFrLogin

    If I understand correctly I have to parse the returned page and follow the link ?

  17. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: amazonFrLogin

    Quote Originally Posted by incapacitant
    If I understand correctly I have to parse the returned page and follow the link ?
    Yes, but probably that link is in one of the HTTP headers too.

  18. The following user says thank you to jacek for this useful post:

    incapacitant (24th July 2006)

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.