I am making a web scraper. In that I need to login into my email account programatically. Can anybody say how to achieve that. I think "QNetworkAccesManager" and it's "get()" can make this. But, I don't know exactly. Somebody please shed a l开发者_如何学运维ight on this issue.
Note: I am using Qt-4.7.2 + C++
If the login is done in a web page then you should perform a post operation using QNetworkAccessManager::post() including the login fields in the data.
For instance:
QNetworkAccessManager network;
QByteArray loginData("user=myName&password=myPassword");
QNetworkRequest request(QUrl("http://mySite.com/login"));
QNetworkReply* pReply(network.post(request, loginData);
If the login is done via HTTP authentication method then you should connect the signal QNetworkAccessManager::authenticationRequired to one slot and fill the authentication data there.
精彩评论