QByteArray *data
= new QByteArray("username="+username
+"&password="+password
+"&if_login=Y&B2=%B5%C7%C2%BC%28Login%29");
http->request(buildHeader(),*data);
QHttp *http = new QHttp("login.xxxx.xxx.xx");
QByteArray username("wbl9115");
QByteArray password("19881010");
QByteArray *data = new QByteArray("username="+username+"&password="+password+"&if_login=Y&B2=%B5%C7%C2%BC%28Login%29");
http->request(buildHeader(),*data);
To copy to clipboard, switch view to plain text mode
QHttpRequestHeader& buildHeader()
{
//constructe header
header.addValue("Accept","image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument,"
" application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/QVOD, */*");
header.addValue("Referer","http://login.xxxx.xxx.xx/index.jsp");
header.addValue("Accept-Language","zh-cn");
header.addValue("ContentType" ,"application/x-www-form-urlencoded");
header.addValue("Accept-Encoding","gzip, deflate");
header.addValue("UserAgent","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727;"
" Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; CIBA)");
header.addValue("Host", "login.xxxx.xxx.xx");
header.addValue("Connection", "Keep-Alive");
header.addValue("Cache-Control", "no-cache");
return header;
}
QHttpRequestHeader& buildHeader()
{
//constructe header
header.addValue("Accept","image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument,"
" application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/QVOD, */*");
header.addValue("Referer","http://login.xxxx.xxx.xx/index.jsp");
header.addValue("Accept-Language","zh-cn");
header.addValue("ContentType" ,"application/x-www-form-urlencoded");
header.addValue("Accept-Encoding","gzip, deflate");
header.addValue("UserAgent","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727;"
" Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; CIBA)");
header.addValue("Host", "login.xxxx.xxx.xx");
header.addValue("Connection", "Keep-Alive");
header.addValue("Cache-Control", "no-cache");
return header;
}
To copy to clipboard, switch view to plain text mode
Bookmarks