PDA

View Full Version : amazonFrLogin



incapacitant
23rd July 2006, 23:05
I call the amazon.fr url as follows :



//************************************************** ***************************
void ApplicationWindow::amazonFrLogin()
//************************************************** ***************************
{
QMessageBox::critical( this, "Mutant", "enter amazonFrLogin" );
// target url
QUrl url("http://www.amazon.fr");

http = new QHttp(this);
connect(http, SIGNAL(done(bool)), this, SLOT(getLogin(bool)));
// remember to set the host
http->setHost(url.host());

// the resulting data will be stored in the buffer
buffer = new QBuffer(this);
http->get(url.toString(), buffer);
}
//************************************************** ***************************
void ApplicationWindow::getLogin( bool error )
//************************************************** ***************************
{
QMessageBox::critical( this, "Mutant", "enter getLogin" );



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 ?

jacek
23rd July 2006, 23:10
QUrl url("<a class="bbcodeurl" href="http://www.amazon.fr" target="_blank">http://www.amazon.fr</a>");
This should be:
QUrl url( "http://www.amazon.fr" );
And make sure you add some delay between requests, not to irritate the admins.

incapacitant
23rd July 2006, 23:16
that is what the code, it has been garbled when i posted should be :


//************************************************** ***************************
void ApplicationWindow::amazonFrLogin()
//************************************************** ***************************
{
QMessageBox::critical( this, "Mutant", "enter amazonFrLogin" );
// target url
QUrl url("http://www.amazon.fr");


Again there is no formatting like this my source code.

jacek
23rd July 2006, 23:20
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?

incapacitant
23rd July 2006, 23:35
:)
This should be:
QUrl url( "http://www.amazon.fr" );
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 :o

incapacitant
23rd July 2006, 23:42
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.:)

incapacitant
24th July 2006, 07:24
I have a problem. The following code does not work properly.
I tried to make it short.



//************************************************** ***************************
void ApplicationWindow::creditUrl()
//************************************************** ***************************
{
// target url
QUrl url("http://api.smsbox.fr/index.php?");
url.addQueryItem("login", iniGet( "Login" ));
url.addQueryItem("pass", iniGet( "Password" ));
url.addQueryItem("action", iniGet( "Action" ));

http = new QHttp(this);
connect(http, SIGNAL(done(bool)), this, SLOT(defineSMSCredit(bool)));
// remember to set the host
http->setHost(url.host());

// the resulting data will be stored in the buffer
buffer = new QBuffer(this);
http->get(url.toString(), buffer);
}

//************************************************** ***************************
void ApplicationWindow::defineSMSCredit( bool error )
//************************************************** ***************************
{
// handle http reply for credit request
handleSMSCredit( error );

// read destin undefined from ini file
qS = iniGet( "TxtDestinataires" ) + " " + iniGet( "TxtIndefini" );
appendRow( qS );
// connect
connect( pbDestin, SIGNAL( clicked() ), this, SLOT( destinataires() ) );
connect( pbArchiv, SIGNAL( clicked() ), this, SLOT( archives() ) );
connect( pbConfig, SIGNAL( clicked() ), this, SLOT( config() ) );
connect( pbApropos, SIGNAL( clicked() ), this, SLOT( apropos() ) );
connect( pbEnvoyer, SIGNAL( clicked() ), this, SLOT( envoyer() ) );
connect( qMessage, SIGNAL( textChanged() ), this, SLOT( messageChanged() ) );
connect( pbClose, SIGNAL( clicked() ), this, SLOT( hide() ) );
return;
}
//************************************************** ***************************
void ApplicationWindow::destinataires()
//************************************************** ***************************
{
QMessageBox::warning( this, "Mutant", "enter destinataires" );
// target url
QUrl url("http://api.smsbox.fr/index.php?");
url.addQueryItem("login", iniGet( "Login" ));
url.addQueryItem("pass", iniGet( "Password" ));
url.addQueryItem("action", iniGet( "Action" ));

http = new QHttp(this);
connect(http, SIGNAL(done(bool)), this, SLOT(amazon_MainPage(bool)));
// remember to set the host
http->setHost(url.host());

// the resulting data will be stored in the buffer
buffer = new QBuffer(this);
http->get(url.toString(), buffer);


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.

incapacitant
24th July 2006, 07:25
the html coding in the urls is added by the post. i don't have it in my code pasting from
notepad !:confused:

jacek
24th July 2006, 12:36
the html coding in the urls is added by the post. i don't have it in my code pasting from
notepad !:confused:
Just uncheck the "Automatically parse links in text" checkbox below the editor.

incapacitant
24th July 2006, 17:09
When I query www.amazon.fr (http://www.amazon.fr) here is what I get back :



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>



rather than the site.

What am I doing wrong ?:)

jacek
24th July 2006, 17:20
What am I doing wrong ?
Nothing --- just open www.amazon.fr with a normal browser and you will be redirected too.

incapacitant
24th July 2006, 17:21
QUrl url("http://www.amazon.fr");


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

incapacitant
24th July 2006, 17:30
If I understand correctly I have to parse the returned page and follow the link ?
:)

jacek
24th July 2006, 17:40
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.