Issues issuing POST request to QWebView
I'm currently trying to issue a POST request to QWebView in order to sign in to a web site automatically.
Below is the POST request I caught using my web debugger:
@POST http://www.forum.com/login/login HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept-Encoding: gzip, deflate
Now here is the code I've written:
payload.append("login=" + username + "®ister=0&password=" + password + "&remember=1&cookie_check=1&_xfToken=&redirect=http://forum.com/someotherpage");
ui->webView->load(request, QNetworkAccessManager::PostOperation, payload);@
The POST request gets sent and seems as though it should work, but I get a 301 moved permanently in response before my QWebView tries to simply load the "http://forum.com/login/login" page (which is a problem since you're just presented with a page telling you that the function is available via POST only).
I'd appreciate any advice you have may have to share. There's probably a better way to go about accomplishing this and I'm probably just missing something stupidly simple...that's usually how it is. All that matters to me is being able to sign in via POST and being able to use the session in a web view.
Anyway, let me know if you need any other information and thanks for reading. n_n
Nevermind. Just had to fix the POST request headers. However, I'm now faced with the issue of cookies. Once I'm redirected after the post request the site tells me that cookies are required.
Any tips on how to go about handling cookies in this situation? xD
If not, I'll probably get it working eventually. :P