Login on a Url
-
Hello everyone, I have a small question, and I think is easy but I'm so much crazy to see.
I'm doying a Upload Image Application, and I have a site I want show the Image. My question is how I can do a login, by my application, on a url? This is possible? How?
-
Well... You should use QNetworkAccessManager and post a request with the url. Assuming that the url is like "http://www.something.com/login?&user=username&password=password" the code would be something like this:
@
QNetworkAccessManager man = new QNetworkAccessManager();
QNetworkRequest req;
req.setUrl(QUrl("http://www.something.com/login?&user=username&password=password"));
man->get(req);
connect(man, SIGNAL(finished(QNetworkReply)), this, SLOT(someSlot(QNetworkReply*)));
@and in the someSlot you process the reply. Here you check if the login is successful or not.