PDA

View Full Version : Posting data to QWebView



chrisb123
26th October 2009, 17:20
Hi

How can I post data to QWebView

chrisb123
27th October 2009, 15:20
or is it even possible?
or can I enter data in a form in an existing widget?

Basically I'm trying to automatically log into a website

wysota
27th October 2009, 15:33
What do you mean "post data to QWebView"? What data? QWebView is just a widget that displays a web page. If you want to log onto the site, you have to post the data to the server and not your local widget.

chrisb123
28th October 2009, 13:58
What I mean is controlling the widget to make it post the login information, as if someone is manually entering the data, if thats possible...
I've tried reading the source code for the login webpage and posting the keys and values that are in the form to the server and displaying the result in the widget. I can display the html data I get back from the server, how do I get the url that the server replies with

wysota
28th October 2009, 15:36
QWebView::load() with your own network request as the argument.

chrisb123
29th October 2009, 06:58
awesome it works as expected


QUrl iws("https://secure.website");
QByteArray iws2;
iws2.append("username=" + user2.toAscii());
iws2.append("&password=" + pass2.toAscii());
load(QNetworkRequest(iws),QNetworkAccessManager::P ostOperation,iws2);