with IdHTTP1.Request do
begin
Referer := 'http://go.kunlun.com/?ref=http://s287.sg.kunlun.com';
Accept := 'image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*';
AcceptEncoding := 'gzip, deflate';
AcceptLanguage := 'zh-cn';
CacheControl := 'no-cache';
Connection:='Keep-Alive';
ContentLength := 178;
Host := 'login.kunlun.com';
UserAgent := 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)';
ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.HandleRedirects := true; //页面转向
//IdHTTP1.AllowCookies := True;
IdHTTP1.HTTPOptions :=[];
IdHTTP1.Request.Accept := 'identity';
IdHTTP1.ProtocolVersion := pv1_1 ;
end;
//ShowMessage('cookies='+cookies);
//IdHTTP1.Request.CustomHeaders.Text:=cookies;
ShowMessage('Cookie: '+mycookie);
IdHTTP1.Request.CustomHeaders.Text:= 'Cookie: '+mycookie; //IdHTTP1.Request. //IdHTTP1.Request.URL := '/?act=user.weblogin';
//ParamList.Add('user=pan');
//ShowMessage(IdHTTP1.Post('http://login.kunlun.com/?act=user.weblogin', ParamList)); //ShowMessage(IdHTTP1.Post('http://go.kunlun.com/index.php', ParamList)); //http://go.kunlun.com/index.php?ref=http://s289.sg.kunlun.com&username=a2996673615&userpass=kaige123&usercode=etud&login=马上登录
ParamList.Add('act=user.weblogin');
ParamList.Add('ref=http://s287.sg.kunlun.com');
ParamList.Add('username=zhangsan');
ParamList.Add('userpass=adminer33'); //
ParamList.Add('usercode='+yzm_str);
ParamList.Add('login=马上登录'); //IdHTTP1.Post('http://go.kunlun.com/index.php', ParamList,SS);
IdHTTP1.Post(url_str,ParamList,SS) ; //IdHTTP1.Post('http%3A%2F%2Fgo.kunlun.com%2Findex.php%3Fref%3Dhttp%3A%2F%2Fs287.sg.kunlun.com&username=fuxuyang&userpass=kaige123&usercode='+yzm_str+'&login=%E9%A9%AC%E4%B8%8A%E7%99%BB%E5%BD%95',ParamList,SS);
ShowMessage(Utf8ToAnsi(SS.DataString));
//ShowMessage(IdHTTP1.Get('http://go.kunlun.com/index.php?retcode=0&retmsg=success&ref=http://s287.sg.kunlun.com') );
FreeAndNil(ParamList);
FreeAndNil(SS);
begin
Referer := 'http://go.kunlun.com/?ref=http://s287.sg.kunlun.com';
Accept := 'image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*';
AcceptEncoding := 'gzip, deflate';
AcceptLanguage := 'zh-cn';
CacheControl := 'no-cache';
Connection:='Keep-Alive';
ContentLength := 178;
Host := 'login.kunlun.com';
UserAgent := 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)';
ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.HandleRedirects := true; //页面转向
//IdHTTP1.AllowCookies := True;
IdHTTP1.HTTPOptions :=[];
IdHTTP1.Request.Accept := 'identity';
IdHTTP1.ProtocolVersion := pv1_1 ;
end;
//ShowMessage('cookies='+cookies);
//IdHTTP1.Request.CustomHeaders.Text:=cookies;
ShowMessage('Cookie: '+mycookie);
IdHTTP1.Request.CustomHeaders.Text:= 'Cookie: '+mycookie; //IdHTTP1.Request. //IdHTTP1.Request.URL := '/?act=user.weblogin';
//ParamList.Add('user=pan');
//ShowMessage(IdHTTP1.Post('http://login.kunlun.com/?act=user.weblogin', ParamList)); //ShowMessage(IdHTTP1.Post('http://go.kunlun.com/index.php', ParamList)); //http://go.kunlun.com/index.php?ref=http://s289.sg.kunlun.com&username=a2996673615&userpass=kaige123&usercode=etud&login=马上登录
ParamList.Add('act=user.weblogin');
ParamList.Add('ref=http://s287.sg.kunlun.com');
ParamList.Add('username=zhangsan');
ParamList.Add('userpass=adminer33'); //
ParamList.Add('usercode='+yzm_str);
ParamList.Add('login=马上登录'); //IdHTTP1.Post('http://go.kunlun.com/index.php', ParamList,SS);
IdHTTP1.Post(url_str,ParamList,SS) ; //IdHTTP1.Post('http%3A%2F%2Fgo.kunlun.com%2Findex.php%3Fref%3Dhttp%3A%2F%2Fs287.sg.kunlun.com&username=fuxuyang&userpass=kaige123&usercode='+yzm_str+'&login=%E9%A9%AC%E4%B8%8A%E7%99%BB%E5%BD%95',ParamList,SS);
ShowMessage(Utf8ToAnsi(SS.DataString));
//ShowMessage(IdHTTP1.Get('http://go.kunlun.com/index.php?retcode=0&retmsg=success&ref=http://s287.sg.kunlun.com') );
FreeAndNil(ParamList);
FreeAndNil(SS);
你手动提交的COOKie,都对吗?