Hi,
We are trying to build QHttp header to get google authentication, but we are ran into troubles while doing that. Can anybody suggest us where we were doing wrong? Please look at following code. Initially we tried with curl command line utility and we were able to get response from google. Just have look at below code..
curl command (successfully got reply from google):
/*
Curl Command:
curl https://google.com/accounts/ClientLogin HTTP/1.0
-d Content-type=application/x-www-form-urlencoded
-d Content-Length=121
-d accountType=HOSTED_OR_GOOGLE
-d Email="xxx@gmail.com"
-d Passwd="xxx"
-d service=lh2
-d source="Blogger-1.0"
-d UserAgent="Client"
*/
code written in Qt:
setHost("google.com",443);
QHttpRequestHeader header("GET","/accounts/ClientLogin");
header.setValue("Host","https://google.com");
header.setValue("Port","443");
header.setContentType("application/x-www-form-urlencoded");
header.setValue("Content-Length", "121");
header.setValue("accountType","HOSTED_OR_GOOGLE");
header.setValue("Email","...@gmail.com");
header.setValue("Passwd","...");
header.setValue("service","lh2");
header.setValue("source","Blogger-1.0");
header.setValue("UserAgent","Client");
int i = request(header,arr);
qDebug()<<"request value = "<<i<<arr;
connect(this,
SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
this,
SLOT(displayData(const QHttpResponseHeader &)));
connect(this,
SIGNAL(stateChanged(int)),
this,
SLOT(displayStateValue(int)));
connect(this,
SIGNAL(requestFinished(int, bool)),
this,
SLOT(displayError(int, bool)));
checking arr buffer after requestFinished signal was emitted!
Thanks in advance.
Regards,
Developer
Bookmarks