therealko
19th December 2012, 13:16
Hi
I just want to see/save the html code from a Webpage, but I have one Problem:
Only result that I get is: <html><head></head><body></body></html>
My code looks like :
//(for testing i put the code in main.cpp)
QWidget * parent;
QWebView * view = new QWebView(parent);
QNetworkAccessManager *nam = new QNetworkAccessManager;
QNetworkReply *reply = nam->get(QNetworkRequest(QURL..));
If I write a localfile address like:
QUrl::fromLocalFile("/home/../page.html")
the result is the whole html code, but if I write "http://website.com"
the result is:
<html><head></head><body></body></html>
for the output i wrote:
qDebug() << QString::fromUtf8(reply->readAll());
I also tried with view->page()->currentFrame()->toHtml(); //same with mainFrame() and ->documentElement()->toPlainText and toOuter/toInnerXml()...
and with view->show(); I can still see the website...
The website is http and not https, so i dont need ssl auth etc.
Can someone help me pls?
greets
I just want to see/save the html code from a Webpage, but I have one Problem:
Only result that I get is: <html><head></head><body></body></html>
My code looks like :
//(for testing i put the code in main.cpp)
QWidget * parent;
QWebView * view = new QWebView(parent);
QNetworkAccessManager *nam = new QNetworkAccessManager;
QNetworkReply *reply = nam->get(QNetworkRequest(QURL..));
If I write a localfile address like:
QUrl::fromLocalFile("/home/../page.html")
the result is the whole html code, but if I write "http://website.com"
the result is:
<html><head></head><body></body></html>
for the output i wrote:
qDebug() << QString::fromUtf8(reply->readAll());
I also tried with view->page()->currentFrame()->toHtml(); //same with mainFrame() and ->documentElement()->toPlainText and toOuter/toInnerXml()...
and with view->show(); I can still see the website...
The website is http and not https, so i dont need ssl auth etc.
Can someone help me pls?
greets